Fix redirect when no format is specified

This commit is contained in:
Pierre Rudloff 2017-03-19 12:27:08 +01:00
parent 9d4569244f
commit 2ebea7749b
2 changed files with 23 additions and 6 deletions

View file

@ -292,6 +292,19 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($result->isRedirect());
}
/**
* Test the redirect() function with a specific format.
* @return void
*/
public function testRedirectWithFormat()
{
$result = $this->controller->redirect(
$this->request->withQueryParams(['url'=>'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'format'=>'worst']),
$this->response
);
$this->assertTrue($result->isRedirect());
}
/**
* Test the redirect() function with streams enabled.
*
@ -317,7 +330,9 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
{
$config = Config::getInstance();
$config->stream = true;
$result = $this->controller->redirect(
//We need to create a new controller instance in order to apply the custom config
$controller = new FrontController($this->container);
$result = $controller->redirect(
$this->request->withQueryParams(['url'=>'https://twitter.com/verge/status/813055465324056576/video/1']),
$this->response
);