You are here

public function BinaryFileResponseTest::testConstruction in Zircon Profile 8

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

File

vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php, line 21

Class

BinaryFileResponseTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testConstruction() {
  $file = __DIR__ . '/../README.md';
  $response = new BinaryFileResponse($file, 404, array(
    'X-Header' => 'Foo',
  ), true, null, true, true);
  $this
    ->assertEquals(404, $response
    ->getStatusCode());
  $this
    ->assertEquals('Foo', $response->headers
    ->get('X-Header'));
  $this
    ->assertTrue($response->headers
    ->has('ETag'));
  $this
    ->assertTrue($response->headers
    ->has('Last-Modified'));
  $this
    ->assertFalse($response->headers
    ->has('Content-Disposition'));
  $response = BinaryFileResponse::create($file, 404, array(), true, ResponseHeaderBag::DISPOSITION_INLINE);
  $this
    ->assertEquals(404, $response
    ->getStatusCode());
  $this
    ->assertFalse($response->headers
    ->has('ETag'));
  $this
    ->assertEquals('inline; filename="README.md"', $response->headers
    ->get('Content-Disposition'));
}