Skip to content

Commit

Permalink
Merge pull request #154 from pennyphp/feature/dispatcher-test
Browse files Browse the repository at this point in the history
Add test dispatcher is a closure
  • Loading branch information
Gianluca Arbezzano committed Dec 29, 2015
2 parents e1a4182 + 52a2735 commit 26bdc55
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/DispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@ public function testDispatchMethodNotAllowedRequest()
$dispatcher($request);
}

public function testDispatcherIsAClosure()
{
$router = $this->prophesize('FastRoute\Dispatcher', PHPDiFactory::buildContainer());
$container = $this->prophesize('Interop\Container\ContainerInterface', PHPDiFactory::buildContainer());
$request = (new ServerRequest())
->withUri(new Uri('/'))
->withMethod('POST');

$router->reveal();
$container->reveal();
$dispatcher = function () use ($router, $container) {
return 'nothing';
};

$this->assertSame('nothing', $dispatcher($request));
}

public function testDispatchGot500Exception()
{
$this->setExpectedException('Exception');
Expand Down

0 comments on commit 26bdc55

Please sign in to comment.