[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 = Request::create('/');
|
||||||
$request->headers->set('X-Sendfile-Type', 'X-Sendfile');
|
$request->headers->set('X-Sendfile-Type', 'X-Sendfile');
|
||||||
|
|
||||||
BinaryFileResponse::trustXSendfileTypeHeader();
|
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);
|
$response->prepare($request);
|
||||||
|
|
||||||
$this->expectOutputString('');
|
$this->expectOutputString('');
|
||||||
@ -168,6 +171,14 @@ class BinaryFileResponseTest extends ResponseTestCase
|
|||||||
$this->assertContains('README.md', $response->headers->get('X-Sendfile'));
|
$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
|
* @dataProvider getSampleXAccelMappings
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user