public function ResponseTest::testIsNotModifiedLastModifiedAndEtag in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/Tests/ResponseTest.php \Symfony\Component\HttpFoundation\Tests\ResponseTest::testIsNotModifiedLastModifiedAndEtag()
File
- vendor/
symfony/ http-foundation/ Tests/ ResponseTest.php, line 202
Class
Namespace
Symfony\Component\HttpFoundation\TestsCode
public function testIsNotModifiedLastModifiedAndEtag() {
$before = 'Sun, 25 Aug 2013 18:32:31 GMT';
$modified = 'Sun, 25 Aug 2013 18:33:31 GMT';
$after = 'Sun, 25 Aug 2013 19:33:31 GMT';
$etag = 'randomly_generated_etag';
$request = new Request();
$request->headers
->set('if_none_match', sprintf('%s, %s', $etag, 'etagThree'));
$request->headers
->set('If-Modified-Since', $modified);
$response = new Response();
$response->headers
->set('ETag', $etag);
$response->headers
->set('Last-Modified', $after);
$this
->assertFalse($response
->isNotModified($request));
$response->headers
->set('ETag', 'non-existent-etag');
$response->headers
->set('Last-Modified', $before);
$this
->assertFalse($response
->isNotModified($request));
$response->headers
->set('ETag', $etag);
$response->headers
->set('Last-Modified', $modified);
$this
->assertTrue($response
->isNotModified($request));
}