use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\Stream;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\HttpFoundation\Tests\File\FakeFile;
class BinaryFileResponseTest extends ResponseTestCase
{ public function testConstruction() { $file = __DIR__.'/../README.md';
$response =
new BinaryFileResponse($file, 404,
['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 =
new BinaryFileResponse($file, 404,
[], 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'
));
}