Skip to content

Commit

Permalink
test UriInterface as a redirect destination
Browse files Browse the repository at this point in the history
  • Loading branch information
ellotheth committed Apr 14, 2018
1 parent 3c6e1d3 commit 8d75908
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/AppTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Pimple\Container as Pimple;
use Pimple\Psr11\Container as Psr11Container;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;
use Slim\App;
use Slim\CallableResolver;
use Slim\Error\Renderers\HtmlErrorRenderer;
Expand Down Expand Up @@ -271,6 +272,13 @@ public function testRedirectRoute()
$routeWithDefaultStatus = $app->redirect($source, $destination);
$response = $routeWithDefaultStatus->run($this->requestFactory($source), new Response());
$this->assertEquals(302, $response->getStatusCode());

$uri = $this->getMockBuilder(UriInterface::class)->getMock();
$uri->expects($this->once())->method('__toString')->willReturn($destination);

$routeToUri = $app->redirect($source, $uri);
$response = $routeToUri->run($this->requestFactory($source), new Response());
$this->assertEquals($destination, $response->getHeaderLine('Location'));
}

/********************************************************************************
Expand Down

0 comments on commit 8d75908

Please sign in to comment.