14 use PHPUnit\Framework\TestCase;
23 $this->assertEquals(1, preg_match(
24 '#<meta http-equiv="refresh" content="\d+;url=foo\.bar" />#',
25 preg_replace(array(
'/\s+/',
'/\'/'), array(
' ',
'"'), $response->getContent())
49 $this->assertTrue($response->headers->has(
'Location'));
50 $this->assertEquals(
'foo.bar', $response->headers->get(
'Location'));
57 $this->assertEquals(
'foo.bar', $response->getTargetUrl());
63 $response->setTargetUrl(
'baz.beep');
65 $this->assertEquals(
'baz.beep', $response->getTargetUrl());
74 $response->setTargetUrl(
null);
81 $this->assertInstanceOf(
'Symfony\Component\HttpFoundation\RedirectResponse', $response);
82 $this->assertEquals(301, $response->getStatusCode());
88 $this->assertFalse($response->headers->hasCacheControlDirective(
'no-cache'));
90 $response =
new RedirectResponse(
'foo.bar', 301, array(
'cache-control' =>
'max-age=86400'));
91 $this->assertFalse($response->headers->hasCacheControlDirective(
'no-cache'));
92 $this->assertTrue($response->headers->hasCacheControlDirective(
'max-age'));
95 $this->assertTrue($response->headers->hasCacheControlDirective(
'no-cache'));