Skip to content
Permalink
Browse files

test UriInterface as a redirect destination

  • Loading branch information...
ellotheth committed Apr 14, 2018
1 parent ffadc6a commit 5a321f274c4e3ba702d136aeb2f026735552f381
Showing with 8 additions and 0 deletions.
  1. +8 −0 tests/AppTest.php
@@ -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;
@@ -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'));
}
/********************************************************************************

0 comments on commit 5a321f2

Please sign in to comment.
You can’t perform that action at this time.