From dd129b71e33ccc6a2bddbab22e2b3b2de0a53766 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Fri, 11 Dec 2015 17:13:59 +0000 Subject: [PATCH] [HttpFoundation] Add a test case for using BinaryFileResponse with stream wrappers --- .../Tests/BinaryFileResponseTest.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php index e4f05fadcf..35dfab5366 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php @@ -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 */