[HttpFoundation] Add a test case for using BinaryFileResponse with stream wrappers
This commit is contained in:
parent
ec39f9da5d
commit
dd129b71e3
@ -153,13 +153,16 @@ class BinaryFileResponseTest extends ResponseTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testXSendfile()
|
||||
/**
|
||||
* @dataProvider provideXSendfileFiles
|
||||
*/
|
||||
public function testXSendfile($file)
|
||||
{
|
||||
$request = Request::create('/');
|
||||
$request->headers->set('X-Sendfile-Type', 'X-Sendfile');
|
||||
|
||||
BinaryFileResponse::trustXSendfileTypeHeader();
|
||||
$response = BinaryFileResponse::create(__DIR__.'/../README.md', 200, array('Content-Type' => 'application/octet-stream'));
|
||||
$response = BinaryFileResponse::create($file, 200, array('Content-Type' => 'application/octet-stream'));
|
||||
$response->prepare($request);
|
||||
|
||||
$this->expectOutputString('');
|
||||
@ -168,6 +171,14 @@ class BinaryFileResponseTest extends ResponseTestCase
|
||||
$this->assertContains('README.md', $response->headers->get('X-Sendfile'));
|
||||
}
|
||||
|
||||
public function provideXSendfileFiles()
|
||||
{
|
||||
return array(
|
||||
array(__DIR__.'/../README.md'),
|
||||
array('file://'.__DIR__.'/../README.md'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getSampleXAccelMappings
|
||||
*/
|
||||
|
Reference in New Issue
Block a user