You are here

public function ResponseTest::testIsNotModifiedLastModified in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Tests/ResponseTest.php \Symfony\Component\HttpFoundation\Tests\ResponseTest::testIsNotModifiedLastModified()

File

vendor/symfony/http-foundation/Tests/ResponseTest.php, line 158

Class

ResponseTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testIsNotModifiedLastModified() {
  $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';
  $request = new Request();
  $request->headers
    ->set('If-Modified-Since', $modified);
  $response = new Response();
  $response->headers
    ->set('Last-Modified', $modified);
  $this
    ->assertTrue($response
    ->isNotModified($request));
  $response->headers
    ->set('Last-Modified', $before);
  $this
    ->assertTrue($response
    ->isNotModified($request));
  $response->headers
    ->set('Last-Modified', $after);
  $this
    ->assertFalse($response
    ->isNotModified($request));
  $response->headers
    ->set('Last-Modified', '');
  $this
    ->assertFalse($response
    ->isNotModified($request));
}