コード例 #1
0
 public function testConstruction()
 {
     $response = new BinaryFileResponse('README.md', 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('README.md', 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'));
 }