Instantiate $offset and $maxlen at definition

This commit is contained in:
Justin 2018-08-26 12:16:17 -04:00 committed by Justin
parent 0332f861c6
commit dba8687a5d
2 changed files with 15 additions and 2 deletions

View File

@ -31,8 +31,8 @@ class BinaryFileResponse extends Response
* @var File
*/
protected $file;
protected $offset;
protected $maxlen;
protected $offset = 0;
protected $maxlen = -1;
protected $deleteFileAfterSend = false;
/**

View File

@ -206,6 +206,19 @@ class BinaryFileResponseTest extends ResponseTestCase
);
}
public function testUnpreparedResponseSendsFullFile()
{
$response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200);
$data = file_get_contents(__DIR__.'/File/Fixtures/test.gif');
$this->expectOutputString($data);
$response = clone $response;
$response->sendContent();
$this->assertEquals(200, $response->getStatusCode());
}
/**
* @dataProvider provideInvalidRanges
*/