Skip to content

Commit

Permalink
and more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tenmajkl committed Nov 13, 2023
1 parent 75e24dc commit e187da3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/Routing/RouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ public function testPriorityOfStaticRoutes()
$r = $this->getRouter();
$r->get('/foo/{bar}', fn($bar) => $bar);
$r->get('/foo/baz', fn() => 'foobaz');
$r->get('foo', fn() => 'foo');

$this->assertThat($r->dispatch($this->emulate('/foo/baz', 'GET')), $this->equalTo(new HtmlResponse('foobaz')));
$this->assertThat($r->dispatch($this->emulate('/foo/bar', 'GET')), $this->equalTo(new HtmlResponse('bar')));
$this->assertThat($r->dispatch($this->emulate('/foo', 'GET')), $this->equalTo(new HtmlResponse('foo')));

$r = $this->getRouter();
$r->collection(function() use ($r) {
Expand All @@ -160,7 +162,7 @@ public function testPriorityOfStaticRoutes()
$this->assertThat($r->dispatch($this->emulate('/foo/baz', 'GET')), $this->equalTo(new HtmlResponse('foobaz')));
$this->assertThat($r->dispatch($this->emulate('/foo/bar', 'GET')), $this->equalTo(new HtmlResponse('bar')));
$this->assertThat($r->dispatch($this->emulate('/foo/baz/baz/foo', 'GET')), $this->equalTo(new HtmlResponse('parek v rohliku')));
$this->assertThat($r->dispatch($this->emulate('/foo/bar/baz/foo', 'GET')), $this->equalTo(new HtmlResponse('barfoo')));
$this->assertThat($r->dispatch($this->emulate('/foo/rizek/baz/parek', 'GET')), $this->equalTo(new HtmlResponse('rizekparek')));

}
}
Expand Down

0 comments on commit e187da3

Please sign in to comment.