[HttpFoundation] added some tests for the previous merge and removed dead code (closes #6037)
This commit is contained in:
parent
1ab492394c
commit
47dfb9cb6a
@ -692,14 +692,8 @@ class Response
|
|||||||
return $age;
|
return $age;
|
||||||
}
|
}
|
||||||
|
|
||||||
$expiry = $this->getExpires();
|
if (null !== $this->getExpires()) {
|
||||||
|
return $this->getExpires()->format('U') - $this->getDate()->format('U');
|
||||||
if (!$expiry instanceof \DateTime && (-1 == $expiry || 0 === $expiry)) {
|
|
||||||
return $expiry;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== $expiry) {
|
|
||||||
return $expiry->format('U') - $this->getDate()->format('U');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -351,6 +351,23 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('', $response->getContent());
|
$this->assertEquals('', $response->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testPrepareSetsPragmaOnHttp10Only()
|
||||||
|
{
|
||||||
|
$request = Request::create('/', 'GET');
|
||||||
|
$request->server->set('SERVER_PROTOCOL', 'HTTP/1.0');
|
||||||
|
|
||||||
|
$response = new Response('foo');
|
||||||
|
$response->prepare($request);
|
||||||
|
$this->assertEquals('no-cache', $response->headers->get('pragma'));
|
||||||
|
$this->assertEquals('-1', $response->headers->get('expires'));
|
||||||
|
|
||||||
|
$request->server->set('SERVER_PROTOCOL', 'HTTP/1.1');
|
||||||
|
$response = new Response('foo');
|
||||||
|
$response->prepare($request);
|
||||||
|
$this->assertFalse($response->headers->has('pragma'));
|
||||||
|
$this->assertFalse($response->headers->has('expires'));
|
||||||
|
}
|
||||||
|
|
||||||
public function testSetCache()
|
public function testSetCache()
|
||||||
{
|
{
|
||||||
$response = new Response();
|
$response = new Response();
|
||||||
|
Reference in New Issue
Block a user