summaryrefslogtreecommitdiff
path: root/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-02-03 13:44:03 +0000
committerGreg Roach <fisharebest@webtrees.net>2019-02-04 11:17:33 +0000
commit7def76c7d817a9ec81e9ae4a03a850514b1a2e1c (patch)
tree3fcf7e8236356daac44f7c17b8c0c5bc736a0926 /vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php
parentadfb3656b8dac8505590490f4f8aaf4bea27881b (diff)
downloadwebtrees-7def76c7d817a9ec81e9ae4a03a850514b1a2e1c.tar.gz
webtrees-7def76c7d817a9ec81e9ae4a03a850514b1a2e1c.tar.bz2
webtrees-7def76c7d817a9ec81e9ae4a03a850514b1a2e1c.zip
Working on upgrade wizard and testing
Diffstat (limited to 'vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php')
-rw-r--r--vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php84
1 files changed, 42 insertions, 42 deletions
diff --git a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php b/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php
index 6bf04e16b7..9f3beb08d1 100644
--- a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php
+++ b/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php
@@ -22,14 +22,14 @@ class BinaryFileResponseTest extends ResponseTestCase
public function testConstruction()
{
$file = __DIR__.'/../README.md';
- $response = new BinaryFileResponse($file, 404, array('X-Header' => 'Foo'), true, null, true, true);
+ $response = new BinaryFileResponse($file, 404, ['X-Header' => 'Foo'], true, null, true, true);
$this->assertEquals(404, $response->getStatusCode());
$this->assertEquals('Foo', $response->headers->get('X-Header'));
$this->assertTrue($response->headers->has('ETag'));
$this->assertTrue($response->headers->has('Last-Modified'));
$this->assertFalse($response->headers->has('Content-Disposition'));
- $response = BinaryFileResponse::create($file, 404, array(), true, ResponseHeaderBag::DISPOSITION_INLINE);
+ $response = BinaryFileResponse::create($file, 404, [], true, ResponseHeaderBag::DISPOSITION_INLINE);
$this->assertEquals(404, $response->getStatusCode());
$this->assertFalse($response->headers->has('ETag'));
$this->assertEquals('inline; filename=README.md', $response->headers->get('Content-Disposition'));
@@ -39,7 +39,7 @@ class BinaryFileResponseTest extends ResponseTestCase
{
touch(sys_get_temp_dir().'/fööö.html');
- $response = new BinaryFileResponse(sys_get_temp_dir().'/fööö.html', 200, array(), true, 'attachment');
+ $response = new BinaryFileResponse(sys_get_temp_dir().'/fööö.html', 200, [], true, 'attachment');
@unlink(sys_get_temp_dir().'/fööö.html');
@@ -85,7 +85,7 @@ class BinaryFileResponseTest extends ResponseTestCase
*/
public function testRequests($requestRange, $offset, $length, $responseRange)
{
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag();
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'])->setAutoEtag();
// do a request to get the ETag
$request = Request::create('/');
@@ -117,7 +117,7 @@ class BinaryFileResponseTest extends ResponseTestCase
*/
public function testRequestsWithoutEtag($requestRange, $offset, $length, $responseRange)
{
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'));
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']);
// do a request to get the LastModified
$request = Request::create('/');
@@ -145,19 +145,19 @@ class BinaryFileResponseTest extends ResponseTestCase
public function provideRanges()
{
- return array(
- array('bytes=1-4', 1, 4, 'bytes 1-4/35'),
- array('bytes=-5', 30, 5, 'bytes 30-34/35'),
- array('bytes=30-', 30, 5, 'bytes 30-34/35'),
- array('bytes=30-30', 30, 1, 'bytes 30-30/35'),
- array('bytes=30-34', 30, 5, 'bytes 30-34/35'),
- );
+ return [
+ ['bytes=1-4', 1, 4, 'bytes 1-4/35'],
+ ['bytes=-5', 30, 5, 'bytes 30-34/35'],
+ ['bytes=30-', 30, 5, 'bytes 30-34/35'],
+ ['bytes=30-30', 30, 1, 'bytes 30-30/35'],
+ ['bytes=30-34', 30, 5, 'bytes 30-34/35'],
+ ];
}
public function testRangeRequestsWithoutLastModifiedDate()
{
// prevent auto last modified
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'), true, null, false, false);
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'], true, null, false, false);
// prepare a request for a range of the testing file
$request = Request::create('/');
@@ -178,7 +178,7 @@ class BinaryFileResponseTest extends ResponseTestCase
*/
public function testFullFileRequests($requestRange)
{
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag();
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'])->setAutoEtag();
// prepare a request for a range of the testing file
$request = Request::create('/');
@@ -198,14 +198,14 @@ class BinaryFileResponseTest extends ResponseTestCase
public function provideFullFileRanges()
{
- return array(
- array('bytes=0-'),
- array('bytes=0-34'),
- array('bytes=-35'),
+ return [
+ ['bytes=0-'],
+ ['bytes=0-34'],
+ ['bytes=-35'],
// Syntactical invalid range-request should also return the full resource
- array('bytes=20-10'),
- array('bytes=50-40'),
- );
+ ['bytes=20-10'],
+ ['bytes=50-40'],
+ ];
}
public function testUnpreparedResponseSendsFullFile()
@@ -226,7 +226,7 @@ class BinaryFileResponseTest extends ResponseTestCase
*/
public function testInvalidRequests($requestRange)
{
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag();
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'])->setAutoEtag();
// prepare a request for a range of the testing file
$request = Request::create('/');
@@ -242,10 +242,10 @@ class BinaryFileResponseTest extends ResponseTestCase
public function provideInvalidRanges()
{
- return array(
- array('bytes=-40'),
- array('bytes=30-40'),
- );
+ return [
+ ['bytes=-40'],
+ ['bytes=30-40'],
+ ];
}
/**
@@ -257,7 +257,7 @@ class BinaryFileResponseTest extends ResponseTestCase
$request->headers->set('X-Sendfile-Type', 'X-Sendfile');
BinaryFileResponse::trustXSendfileTypeHeader();
- $response = BinaryFileResponse::create($file, 200, array('Content-Type' => 'application/octet-stream'));
+ $response = BinaryFileResponse::create($file, 200, ['Content-Type' => 'application/octet-stream']);
$response->prepare($request);
$this->expectOutputString('');
@@ -268,10 +268,10 @@ class BinaryFileResponseTest extends ResponseTestCase
public function provideXSendfileFiles()
{
- return array(
- array(__DIR__.'/../README.md'),
- array('file://'.__DIR__.'/../README.md'),
- );
+ return [
+ [__DIR__.'/../README.md'],
+ ['file://'.__DIR__.'/../README.md'],
+ ];
}
/**
@@ -286,7 +286,7 @@ class BinaryFileResponseTest extends ResponseTestCase
$file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test');
BinaryFileResponse::trustXSendfileTypeHeader();
- $response = new BinaryFileResponse($file, 200, array('Content-Type' => 'application/octet-stream'));
+ $response = new BinaryFileResponse($file, 200, ['Content-Type' => 'application/octet-stream']);
$reflection = new \ReflectionObject($response);
$property = $reflection->getProperty('file');
$property->setAccessible(true);
@@ -305,7 +305,7 @@ class BinaryFileResponseTest extends ResponseTestCase
$realPath = realpath($path);
$this->assertFileExists($realPath);
- $response = new BinaryFileResponse($realPath, 200, array('Content-Type' => 'application/octet-stream'));
+ $response = new BinaryFileResponse($realPath, 200, ['Content-Type' => 'application/octet-stream']);
$response->deleteFileAfterSend(true);
$response->prepare($request);
@@ -317,7 +317,7 @@ class BinaryFileResponseTest extends ResponseTestCase
public function testAcceptRangeOnUnsafeMethods()
{
$request = Request::create('/', 'POST');
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'));
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']);
$response->prepare($request);
$this->assertEquals('none', $response->headers->get('Accept-Ranges'));
@@ -326,7 +326,7 @@ class BinaryFileResponseTest extends ResponseTestCase
public function testAcceptRangeNotOverriden()
{
$request = Request::create('/', 'POST');
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'));
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']);
$response->headers->set('Accept-Ranges', 'foo');
$response->prepare($request);
@@ -335,17 +335,17 @@ class BinaryFileResponseTest extends ResponseTestCase
public function getSampleXAccelMappings()
{
- return array(
- array('/var/www/var/www/files/foo.txt', '/var/www/=/files/', '/files/var/www/files/foo.txt'),
- array('/home/Foo/bar.txt', '/var/www/=/files/,/home/Foo/=/baz/', '/baz/bar.txt'),
- array('/home/Foo/bar.txt', '"/var/www/"="/files/", "/home/Foo/"="/baz/"', '/baz/bar.txt'),
- );
+ return [
+ ['/var/www/var/www/files/foo.txt', '/var/www/=/files/', '/files/var/www/files/foo.txt'],
+ ['/home/Foo/bar.txt', '/var/www/=/files/,/home/Foo/=/baz/', '/baz/bar.txt'],
+ ['/home/Foo/bar.txt', '"/var/www/"="/files/", "/home/Foo/"="/baz/"', '/baz/bar.txt'],
+ ];
}
public function testStream()
{
$request = Request::create('/');
- $response = new BinaryFileResponse(new Stream(__DIR__.'/../README.md'), 200, array('Content-Type' => 'text/plain'));
+ $response = new BinaryFileResponse(new Stream(__DIR__.'/../README.md'), 200, ['Content-Type' => 'text/plain']);
$response->prepare($request);
$this->assertNull($response->headers->get('Content-Length'));
@@ -353,7 +353,7 @@ class BinaryFileResponseTest extends ResponseTestCase
protected function provideResponse()
{
- return new BinaryFileResponse(__DIR__.'/../README.md', 200, array('Content-Type' => 'application/octet-stream'));
+ return new BinaryFileResponse(__DIR__.'/../README.md', 200, ['Content-Type' => 'application/octet-stream']);
}
public static function tearDownAfterClass()