Closed
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 3.2.1 |
- PHPUnit 5.7.4
- PHP 7.0.13
- Windows7x64
- Symfony 3.2.1
the following test, taken from https://symfony.com/doc/current/testing.html#working-with-the-test-client (scroll up to Useful Assertions), shows the example without domain:
// Assert that the response is a redirect to /demo/contact
$this->assertTrue(
$client->getResponse()->isRedirect('/demo/contact'),
'response is a redirect to /demo/contact'
);
doing the same in my tests fails:
public function testPressRedirect()
{
$client = static::createClient();
$client->request('GET', '/press');
$this->assertTrue($client->getResponse()->isRedirect('/en/press')); //fails
}
routing.yml
_press_redirect:
path: /press
defaults:
_controller: FrameworkBundle:Redirect:urlRedirect
path: /en/press
permanent: true
I have to include the domain and the protocol to make it work:
public function testPressRedirect()
{
$client = static::createClient();
$client->request('GET', '/press');
$this->assertTrue($client->getResponse()->isRedirect('http://localhost/en/press')); //works
}
Metadata
Metadata
Assignees
Labels
No labels