You are here

public function BinaryFileResponseTest::testFullFileRequests in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php \Symfony\Component\HttpFoundation\Tests\BinaryFileResponseTest::testFullFileRequests()

@dataProvider provideFullFileRanges

File

vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php, line 97

Class

BinaryFileResponseTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testFullFileRequests($requestRange) {
  $response = BinaryFileResponse::create(__DIR__ . '/File/Fixtures/test.gif', 200, array(
    'Content-Type' => 'application/octet-stream',
  ))
    ->setAutoEtag();

  // prepare a request for a range of the testing file
  $request = Request::create('/');
  $request->headers
    ->set('Range', $requestRange);
  $file = fopen(__DIR__ . '/File/Fixtures/test.gif', 'r');
  $data = fread($file, 35);
  fclose($file);
  $this
    ->expectOutputString($data);
  $response = clone $response;
  $response
    ->prepare($request);
  $response
    ->sendContent();
  $this
    ->assertEquals(200, $response
    ->getStatusCode());
}