aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/php/vendor/symfony/http-foundation/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'assets/php/vendor/symfony/http-foundation/Tests')
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php113
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php103
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php93
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php352
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/CookieTest.php223
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php69
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/File/FakeFile.php45
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/File/FileTest.php180
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/.unknownextension1
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/directory/.empty0
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/other-file.example0
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/testbin35 -> 0 bytes
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/test.gifbin35 -> 0 bytes
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php90
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php273
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/FileBagTest.php175
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/HeaderBagTest.php205
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/IpUtilsTest.php104
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/JsonResponseTest.php257
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/ParameterBagTest.php194
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php97
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php151
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/RequestStackTest.php70
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/RequestTest.php2329
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php363
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/ResponseTest.php1003
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/ResponseTestCase.php89
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/ServerBagTest.php170
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php186
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php182
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php161
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php132
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/SessionTest.php242
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php61
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/common.inc151
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.expected17
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.php8
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.expected14
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.php8
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.expected24
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.php10
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.expected20
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.php24
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.expected15
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.php8
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected24
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.php13
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php135
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php139
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php333
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php77
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php38
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php59
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php411
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php189
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php97
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php139
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php131
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php127
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php277
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php96
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php113
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/NativeProxyTest.php38
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php124
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php126
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/schema/http-status-codes.rng31
-rwxr-xr-xassets/php/vendor/symfony/http-foundation/Tests/schema/iana-registry.rng198
67 files changed, 0 insertions, 10927 deletions
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php b/assets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php
deleted file mode 100755
index cb43bb3..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\AcceptHeaderItem;
-
-class AcceptHeaderItemTest extends TestCase
-{
- /**
- * @dataProvider provideFromStringData
- */
- public function testFromString($string, $value, array $attributes)
- {
- $item = AcceptHeaderItem::fromString($string);
- $this->assertEquals($value, $item->getValue());
- $this->assertEquals($attributes, $item->getAttributes());
- }
-
- public function provideFromStringData()
- {
- return array(
- array(
- 'text/html',
- 'text/html', array(),
- ),
- array(
- '"this;should,not=matter"',
- 'this;should,not=matter', array(),
- ),
- array(
- "text/plain; charset=utf-8;param=\"this;should,not=matter\";\tfootnotes=true",
- 'text/plain', array('charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'),
- ),
- array(
- '"this;should,not=matter";charset=utf-8',
- 'this;should,not=matter', array('charset' => 'utf-8'),
- ),
- );
- }
-
- /**
- * @dataProvider provideToStringData
- */
- public function testToString($value, array $attributes, $string)
- {
- $item = new AcceptHeaderItem($value, $attributes);
- $this->assertEquals($string, (string) $item);
- }
-
- public function provideToStringData()
- {
- return array(
- array(
- 'text/html', array(),
- 'text/html',
- ),
- array(
- 'text/plain', array('charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'),
- 'text/plain;charset=utf-8;param="this;should,not=matter";footnotes=true',
- ),
- );
- }
-
- public function testValue()
- {
- $item = new AcceptHeaderItem('value', array());
- $this->assertEquals('value', $item->getValue());
-
- $item->setValue('new value');
- $this->assertEquals('new value', $item->getValue());
-
- $item->setValue(1);
- $this->assertEquals('1', $item->getValue());
- }
-
- public function testQuality()
- {
- $item = new AcceptHeaderItem('value', array());
- $this->assertEquals(1.0, $item->getQuality());
-
- $item->setQuality(0.5);
- $this->assertEquals(0.5, $item->getQuality());
-
- $item->setAttribute('q', 0.75);
- $this->assertEquals(0.75, $item->getQuality());
- $this->assertFalse($item->hasAttribute('q'));
- }
-
- public function testAttribute()
- {
- $item = new AcceptHeaderItem('value', array());
- $this->assertEquals(array(), $item->getAttributes());
- $this->assertFalse($item->hasAttribute('test'));
- $this->assertNull($item->getAttribute('test'));
- $this->assertEquals('default', $item->getAttribute('test', 'default'));
-
- $item->setAttribute('test', 'value');
- $this->assertEquals(array('test' => 'value'), $item->getAttributes());
- $this->assertTrue($item->hasAttribute('test'));
- $this->assertEquals('value', $item->getAttribute('test'));
- $this->assertEquals('value', $item->getAttribute('test', 'default'));
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php b/assets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php
deleted file mode 100755
index 9929eac..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\AcceptHeader;
-use Symfony\Component\HttpFoundation\AcceptHeaderItem;
-
-class AcceptHeaderTest extends TestCase
-{
- public function testFirst()
- {
- $header = AcceptHeader::fromString('text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c');
- $this->assertSame('text/html', $header->first()->getValue());
- }
-
- /**
- * @dataProvider provideFromStringData
- */
- public function testFromString($string, array $items)
- {
- $header = AcceptHeader::fromString($string);
- $parsed = array_values($header->all());
- // reset index since the fixtures don't have them set
- foreach ($parsed as $item) {
- $item->setIndex(0);
- }
- $this->assertEquals($items, $parsed);
- }
-
- public function provideFromStringData()
- {
- return array(
- array('', array()),
- array('gzip', array(new AcceptHeaderItem('gzip'))),
- array('gzip,deflate,sdch', array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch'))),
- array("gzip, deflate\t,sdch", array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch'))),
- array('"this;should,not=matter"', array(new AcceptHeaderItem('this;should,not=matter'))),
- );
- }
-
- /**
- * @dataProvider provideToStringData
- */
- public function testToString(array $items, $string)
- {
- $header = new AcceptHeader($items);
- $this->assertEquals($string, (string) $header);
- }
-
- public function provideToStringData()
- {
- return array(
- array(array(), ''),
- array(array(new AcceptHeaderItem('gzip')), 'gzip'),
- array(array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')), 'gzip,deflate,sdch'),
- array(array(new AcceptHeaderItem('this;should,not=matter')), 'this;should,not=matter'),
- );
- }
-
- /**
- * @dataProvider provideFilterData
- */
- public function testFilter($string, $filter, array $values)
- {
- $header = AcceptHeader::fromString($string)->filter($filter);
- $this->assertEquals($values, array_keys($header->all()));
- }
-
- public function provideFilterData()
- {
- return array(
- array('fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4', '/fr.*/', array('fr-FR', 'fr')),
- );
- }
-
- /**
- * @dataProvider provideSortingData
- */
- public function testSorting($string, array $values)
- {
- $header = AcceptHeader::fromString($string);
- $this->assertEquals($values, array_keys($header->all()));
- }
-
- public function provideSortingData()
- {
- return array(
- 'quality has priority' => array('*;q=0.3,ISO-8859-1,utf-8;q=0.7', array('ISO-8859-1', 'utf-8', '*')),
- 'order matters when q is equal' => array('*;q=0.3,ISO-8859-1;q=0.7,utf-8;q=0.7', array('ISO-8859-1', 'utf-8', '*')),
- 'order matters when q is equal2' => array('*;q=0.3,utf-8;q=0.7,ISO-8859-1;q=0.7', array('utf-8', 'ISO-8859-1', '*')),
- );
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php b/assets/php/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php
deleted file mode 100755
index 157ab90..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\ApacheRequest;
-
-class ApacheRequestTest extends TestCase
-{
- /**
- * @dataProvider provideServerVars
- */
- public function testUriMethods($server, $expectedRequestUri, $expectedBaseUrl, $expectedPathInfo)
- {
- $request = new ApacheRequest();
- $request->server->replace($server);
-
- $this->assertEquals($expectedRequestUri, $request->getRequestUri(), '->getRequestUri() is correct');
- $this->assertEquals($expectedBaseUrl, $request->getBaseUrl(), '->getBaseUrl() is correct');
- $this->assertEquals($expectedPathInfo, $request->getPathInfo(), '->getPathInfo() is correct');
- }
-
- public function provideServerVars()
- {
- return array(
- array(
- array(
- 'REQUEST_URI' => '/foo/app_dev.php/bar',
- 'SCRIPT_NAME' => '/foo/app_dev.php',
- 'PATH_INFO' => '/bar',
- ),
- '/foo/app_dev.php/bar',
- '/foo/app_dev.php',
- '/bar',
- ),
- array(
- array(
- 'REQUEST_URI' => '/foo/bar',
- 'SCRIPT_NAME' => '/foo/app_dev.php',
- ),
- '/foo/bar',
- '/foo',
- '/bar',
- ),
- array(
- array(
- 'REQUEST_URI' => '/app_dev.php/foo/bar',
- 'SCRIPT_NAME' => '/app_dev.php',
- 'PATH_INFO' => '/foo/bar',
- ),
- '/app_dev.php/foo/bar',
- '/app_dev.php',
- '/foo/bar',
- ),
- array(
- array(
- 'REQUEST_URI' => '/foo/bar',
- 'SCRIPT_NAME' => '/app_dev.php',
- ),
- '/foo/bar',
- '',
- '/foo/bar',
- ),
- array(
- array(
- 'REQUEST_URI' => '/app_dev.php',
- 'SCRIPT_NAME' => '/app_dev.php',
- ),
- '/app_dev.php',
- '/app_dev.php',
- '/',
- ),
- array(
- array(
- 'REQUEST_URI' => '/',
- 'SCRIPT_NAME' => '/app_dev.php',
- ),
- '/',
- '',
- '/',
- ),
- );
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php b/assets/php/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php
deleted file mode 100755
index 1b9e589..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php
+++ /dev/null
@@ -1,352 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use Symfony\Component\HttpFoundation\BinaryFileResponse;
-use Symfony\Component\HttpFoundation\File\Stream;
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\ResponseHeaderBag;
-use Symfony\Component\HttpFoundation\Tests\File\FakeFile;
-
-class BinaryFileResponseTest extends ResponseTestCase
-{
- public function testConstruction()
- {
- $file = __DIR__.'/../README.md';
- $response = new BinaryFileResponse($file, 404, array('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);
- $this->assertEquals(404, $response->getStatusCode());
- $this->assertFalse($response->headers->has('ETag'));
- $this->assertEquals('inline; filename="README.md"', $response->headers->get('Content-Disposition'));
- }
-
- public function testConstructWithNonAsciiFilename()
- {
- touch(sys_get_temp_dir().'/fööö.html');
-
- $response = new BinaryFileResponse(sys_get_temp_dir().'/fööö.html', 200, array(), true, 'attachment');
-
- @unlink(sys_get_temp_dir().'/fööö.html');
-
- $this->assertSame('fööö.html', $response->getFile()->getFilename());
- }
-
- /**
- * @expectedException \LogicException
- */
- public function testSetContent()
- {
- $response = new BinaryFileResponse(__FILE__);
- $response->setContent('foo');
- }
-
- public function testGetContent()
- {
- $response = new BinaryFileResponse(__FILE__);
- $this->assertFalse($response->getContent());
- }
-
- public function testSetContentDispositionGeneratesSafeFallbackFilename()
- {
- $response = new BinaryFileResponse(__FILE__);
- $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'föö.html');
-
- $this->assertSame('attachment; filename="f__.html"; filename*=utf-8\'\'f%C3%B6%C3%B6.html', $response->headers->get('Content-Disposition'));
- }
-
- public function testSetContentDispositionGeneratesSafeFallbackFilenameForWronglyEncodedFilename()
- {
- $response = new BinaryFileResponse(__FILE__);
-
- $iso88591EncodedFilename = utf8_decode('föö.html');
- $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $iso88591EncodedFilename);
-
- // the parameter filename* is invalid in this case (rawurldecode('f%F6%F6') does not provide a UTF-8 string but an ISO-8859-1 encoded one)
- $this->assertSame('attachment; filename="f__.html"; filename*=utf-8\'\'f%F6%F6.html', $response->headers->get('Content-Disposition'));
- }
-
- /**
- * @dataProvider provideRanges
- */
- public function testRequests($requestRange, $offset, $length, $responseRange)
- {
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag();
-
- // do a request to get the ETag
- $request = Request::create('/');
- $response->prepare($request);
- $etag = $response->headers->get('ETag');
-
- // prepare a request for a range of the testing file
- $request = Request::create('/');
- $request->headers->set('If-Range', $etag);
- $request->headers->set('Range', $requestRange);
-
- $file = fopen(__DIR__.'/File/Fixtures/test.gif', 'r');
- fseek($file, $offset);
- $data = fread($file, $length);
- fclose($file);
-
- $this->expectOutputString($data);
- $response = clone $response;
- $response->prepare($request);
- $response->sendContent();
-
- $this->assertEquals(206, $response->getStatusCode());
- $this->assertEquals($responseRange, $response->headers->get('Content-Range'));
- $this->assertSame($length, $response->headers->get('Content-Length'));
- }
-
- /**
- * @dataProvider provideRanges
- */
- public function testRequestsWithoutEtag($requestRange, $offset, $length, $responseRange)
- {
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'));
-
- // do a request to get the LastModified
- $request = Request::create('/');
- $response->prepare($request);
- $lastModified = $response->headers->get('Last-Modified');
-
- // prepare a request for a range of the testing file
- $request = Request::create('/');
- $request->headers->set('If-Range', $lastModified);
- $request->headers->set('Range', $requestRange);
-
- $file = fopen(__DIR__.'/File/Fixtures/test.gif', 'r');
- fseek($file, $offset);
- $data = fread($file, $length);
- fclose($file);
-
- $this->expectOutputString($data);
- $response = clone $response;
- $response->prepare($request);
- $response->sendContent();
-
- $this->assertEquals(206, $response->getStatusCode());
- $this->assertEquals($responseRange, $response->headers->get('Content-Range'));
- }
-
- 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'),
- );
- }
-
- 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);
-
- // prepare a request for a range of the testing file
- $request = Request::create('/');
- $request->headers->set('If-Range', date('D, d M Y H:i:s').' GMT');
- $request->headers->set('Range', 'bytes=1-4');
-
- $this->expectOutputString(file_get_contents(__DIR__.'/File/Fixtures/test.gif'));
- $response = clone $response;
- $response->prepare($request);
- $response->sendContent();
-
- $this->assertEquals(200, $response->getStatusCode());
- $this->assertNull($response->headers->get('Content-Range'));
- }
-
- /**
- * @dataProvider provideFullFileRanges
- */
- 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());
- }
-
- public function provideFullFileRanges()
- {
- return array(
- array('bytes=0-'),
- array('bytes=0-34'),
- array('bytes=-35'),
- // Syntactical invalid range-request should also return the full resource
- array('bytes=20-10'),
- array('bytes=50-40'),
- );
- }
-
- /**
- * @dataProvider provideInvalidRanges
- */
- public function testInvalidRequests($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);
-
- $response = clone $response;
- $response->prepare($request);
- $response->sendContent();
-
- $this->assertEquals(416, $response->getStatusCode());
- $this->assertEquals('bytes */35', $response->headers->get('Content-Range'));
- }
-
- public function provideInvalidRanges()
- {
- return array(
- array('bytes=-40'),
- array('bytes=30-40'),
- );
- }
-
- /**
- * @dataProvider provideXSendfileFiles
- */
- public function testXSendfile($file)
- {
- $request = Request::create('/');
- $request->headers->set('X-Sendfile-Type', 'X-Sendfile');
-
- BinaryFileResponse::trustXSendfileTypeHeader();
- $response = BinaryFileResponse::create($file, 200, array('Content-Type' => 'application/octet-stream'));
- $response->prepare($request);
-
- $this->expectOutputString('');
- $response->sendContent();
-
- $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
- */
- public function testXAccelMapping($realpath, $mapping, $virtual)
- {
- $request = Request::create('/');
- $request->headers->set('X-Sendfile-Type', 'X-Accel-Redirect');
- $request->headers->set('X-Accel-Mapping', $mapping);
-
- $file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test');
-
- BinaryFileResponse::trustXSendfileTypeHeader();
- $response = new BinaryFileResponse($file, 200, array('Content-Type' => 'application/octet-stream'));
- $reflection = new \ReflectionObject($response);
- $property = $reflection->getProperty('file');
- $property->setAccessible(true);
- $property->setValue($response, $file);
-
- $response->prepare($request);
- $this->assertEquals($virtual, $response->headers->get('X-Accel-Redirect'));
- }
-
- public function testDeleteFileAfterSend()
- {
- $request = Request::create('/');
-
- $path = __DIR__.'/File/Fixtures/to_delete';
- touch($path);
- $realPath = realpath($path);
- $this->assertFileExists($realPath);
-
- $response = new BinaryFileResponse($realPath, 200, array('Content-Type' => 'application/octet-stream'));
- $response->deleteFileAfterSend(true);
-
- $response->prepare($request);
- $response->sendContent();
-
- $this->assertFileNotExists($path);
- }
-
- public function testAcceptRangeOnUnsafeMethods()
- {
- $request = Request::create('/', 'POST');
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'));
- $response->prepare($request);
-
- $this->assertEquals('none', $response->headers->get('Accept-Ranges'));
- }
-
- public function testAcceptRangeNotOverriden()
- {
- $request = Request::create('/', 'POST');
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'));
- $response->headers->set('Accept-Ranges', 'foo');
- $response->prepare($request);
-
- $this->assertEquals('foo', $response->headers->get('Accept-Ranges'));
- }
-
- 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'),
- );
- }
-
- public function testStream()
- {
- $request = Request::create('/');
- $response = new BinaryFileResponse(new Stream(__DIR__.'/../README.md'), 200, array('Content-Type' => 'text/plain'));
- $response->prepare($request);
-
- $this->assertNull($response->headers->get('Content-Length'));
- }
-
- protected function provideResponse()
- {
- return new BinaryFileResponse(__DIR__.'/../README.md', 200, array('Content-Type' => 'application/octet-stream'));
- }
-
- public static function tearDownAfterClass()
- {
- $path = __DIR__.'/../Fixtures/to_delete';
- if (file_exists($path)) {
- @unlink($path);
- }
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/CookieTest.php b/assets/php/vendor/symfony/http-foundation/Tests/CookieTest.php
deleted file mode 100755
index 070b7dd..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/CookieTest.php
+++ /dev/null
@@ -1,223 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Cookie;
-
-/**
- * CookieTest.
- *
- * @author John Kary <john@johnkary.net>
- * @author Hugo Hamon <hugo.hamon@sensio.com>
- *
- * @group time-sensitive
- */
-class CookieTest extends TestCase
-{
- public function invalidNames()
- {
- return array(
- array(''),
- array(',MyName'),
- array(';MyName'),
- array(' MyName'),
- array("\tMyName"),
- array("\rMyName"),
- array("\nMyName"),
- array("\013MyName"),
- array("\014MyName"),
- );
- }
-
- /**
- * @dataProvider invalidNames
- * @expectedException \InvalidArgumentException
- */
- public function testInstantiationThrowsExceptionIfCookieNameContainsInvalidCharacters($name)
- {
- new Cookie($name);
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testInvalidExpiration()
- {
- new Cookie('MyCookie', 'foo', 'bar');
- }
-
- public function testNegativeExpirationIsNotPossible()
- {
- $cookie = new Cookie('foo', 'bar', -100);
-
- $this->assertSame(0, $cookie->getExpiresTime());
- }
-
- public function testGetValue()
- {
- $value = 'MyValue';
- $cookie = new Cookie('MyCookie', $value);
-
- $this->assertSame($value, $cookie->getValue(), '->getValue() returns the proper value');
- }
-
- public function testGetPath()
- {
- $cookie = new Cookie('foo', 'bar');
-
- $this->assertSame('/', $cookie->getPath(), '->getPath() returns / as the default path');
- }
-
- public function testGetExpiresTime()
- {
- $cookie = new Cookie('foo', 'bar');
-
- $this->assertEquals(0, $cookie->getExpiresTime(), '->getExpiresTime() returns the default expire date');
-
- $cookie = new Cookie('foo', 'bar', $expire = time() + 3600);
-
- $this->assertEquals($expire, $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date');
- }
-
- public function testGetExpiresTimeIsCastToInt()
- {
- $cookie = new Cookie('foo', 'bar', 3600.9);
-
- $this->assertSame(3600, $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date as an integer');
- }
-
- public function testConstructorWithDateTime()
- {
- $expire = new \DateTime();
- $cookie = new Cookie('foo', 'bar', $expire);
-
- $this->assertEquals($expire->format('U'), $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date');
- }
-
- /**
- * @requires PHP 5.5
- */
- public function testConstructorWithDateTimeImmutable()
- {
- $expire = new \DateTimeImmutable();
- $cookie = new Cookie('foo', 'bar', $expire);
-
- $this->assertEquals($expire->format('U'), $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date');
- }
-
- public function testGetExpiresTimeWithStringValue()
- {
- $value = '+1 day';
- $cookie = new Cookie('foo', 'bar', $value);
- $expire = strtotime($value);
-
- $this->assertEquals($expire, $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date', 1);
- }
-
- public function testGetDomain()
- {
- $cookie = new Cookie('foo', 'bar', 0, '/', '.myfoodomain.com');
-
- $this->assertEquals('.myfoodomain.com', $cookie->getDomain(), '->getDomain() returns the domain name on which the cookie is valid');
- }
-
- public function testIsSecure()
- {
- $cookie = new Cookie('foo', 'bar', 0, '/', '.myfoodomain.com', true);
-
- $this->assertTrue($cookie->isSecure(), '->isSecure() returns whether the cookie is transmitted over HTTPS');
- }
-
- public function testIsHttpOnly()
- {
- $cookie = new Cookie('foo', 'bar', 0, '/', '.myfoodomain.com', false, true);
-
- $this->assertTrue($cookie->isHttpOnly(), '->isHttpOnly() returns whether the cookie is only transmitted over HTTP');
- }
-
- public function testCookieIsNotCleared()
- {
- $cookie = new Cookie('foo', 'bar', time() + 3600 * 24);
-
- $this->assertFalse($cookie->isCleared(), '->isCleared() returns false if the cookie did not expire yet');
- }
-
- public function testCookieIsCleared()
- {
- $cookie = new Cookie('foo', 'bar', time() - 20);
-
- $this->assertTrue($cookie->isCleared(), '->isCleared() returns true if the cookie has expired');
- }
-
- public function testToString()
- {
- $cookie = new Cookie('foo', 'bar', $expire = strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true);
- $this->assertEquals('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; max-age='.($expire - time()).'; path=/; domain=.myfoodomain.com; secure; httponly', (string) $cookie, '->__toString() returns string representation of the cookie');
-
- $cookie = new Cookie('foo', 'bar with white spaces', strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true);
- $this->assertEquals('foo=bar%20with%20white%20spaces; expires=Fri, 20-May-2011 15:25:52 GMT; max-age='.($expire - time()).'; path=/; domain=.myfoodomain.com; secure; httponly', (string) $cookie, '->__toString() encodes the value of the cookie according to RFC 3986 (white space = %20)');
-
- $cookie = new Cookie('foo', null, 1, '/admin/', '.myfoodomain.com');
- $this->assertEquals('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', $expire = time() - 31536001).'; max-age='.($expire - time()).'; path=/admin/; domain=.myfoodomain.com; httponly', (string) $cookie, '->__toString() returns string representation of a cleared cookie if value is NULL');
-
- $cookie = new Cookie('foo', 'bar', 0, '/', '');
- $this->assertEquals('foo=bar; path=/; httponly', (string) $cookie);
- }
-
- public function testRawCookie()
- {
- $cookie = new Cookie('foo', 'b a r', 0, '/', null, false, false);
- $this->assertFalse($cookie->isRaw());
- $this->assertEquals('foo=b%20a%20r; path=/', (string) $cookie);
-
- $cookie = new Cookie('foo', 'b+a+r', 0, '/', null, false, false, true);
- $this->assertTrue($cookie->isRaw());
- $this->assertEquals('foo=b+a+r; path=/', (string) $cookie);
- }
-
- public function testGetMaxAge()
- {
- $cookie = new Cookie('foo', 'bar');
- $this->assertEquals(0, $cookie->getMaxAge());
-
- $cookie = new Cookie('foo', 'bar', $expire = time() + 100);
- $this->assertEquals($expire - time(), $cookie->getMaxAge());
-
- $cookie = new Cookie('foo', 'bar', $expire = time() - 100);
- $this->assertEquals($expire - time(), $cookie->getMaxAge());
- }
-
- public function testFromString()
- {
- $cookie = Cookie::fromString('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly');
- $this->assertEquals(new Cookie('foo', 'bar', strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true, true, true), $cookie);
-
- $cookie = Cookie::fromString('foo=bar', true);
- $this->assertEquals(new Cookie('foo', 'bar', 0, '/', null, false, false), $cookie);
- }
-
- public function testFromStringWithHttpOnly()
- {
- $cookie = Cookie::fromString('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly');
- $this->assertTrue($cookie->isHttpOnly());
-
- $cookie = Cookie::fromString('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure');
- $this->assertFalse($cookie->isHttpOnly());
- }
-
- public function testSameSiteAttributeIsCaseInsensitive()
- {
- $cookie = new Cookie('foo', 'bar', 0, '/', null, false, true, false, 'Lax');
- $this->assertEquals('lax', $cookie->getSameSite());
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php b/assets/php/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php
deleted file mode 100755
index 1152e46..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
-use Symfony\Component\HttpFoundation\ExpressionRequestMatcher;
-use Symfony\Component\HttpFoundation\Request;
-
-class ExpressionRequestMatcherTest extends TestCase
-{
- /**
- * @expectedException \LogicException
- */
- public function testWhenNoExpressionIsSet()
- {
- $expressionRequestMatcher = new ExpressionRequestMatcher();
- $expressionRequestMatcher->matches(new Request());
- }
-
- /**
- * @dataProvider provideExpressions
- */
- public function testMatchesWhenParentMatchesIsTrue($expression, $expected)
- {
- $request = Request::create('/foo');
- $expressionRequestMatcher = new ExpressionRequestMatcher();
-
- $expressionRequestMatcher->setExpression(new ExpressionLanguage(), $expression);
- $this->assertSame($expected, $expressionRequestMatcher->matches($request));
- }
-
- /**
- * @dataProvider provideExpressions
- */
- public function testMatchesWhenParentMatchesIsFalse($expression)
- {
- $request = Request::create('/foo');
- $request->attributes->set('foo', 'foo');
- $expressionRequestMatcher = new ExpressionRequestMatcher();
- $expressionRequestMatcher->matchAttribute('foo', 'bar');
-
- $expressionRequestMatcher->setExpression(new ExpressionLanguage(), $expression);
- $this->assertFalse($expressionRequestMatcher->matches($request));
- }
-
- public function provideExpressions()
- {
- return array(
- array('request.getMethod() == method', true),
- array('request.getPathInfo() == path', true),
- array('request.getHost() == host', true),
- array('request.getClientIp() == ip', true),
- array('request.attributes.all() == attributes', true),
- array('request.getMethod() == method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', true),
- array('request.getMethod() != method', false),
- array('request.getMethod() != method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', false),
- );
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/FakeFile.php b/assets/php/vendor/symfony/http-foundation/Tests/File/FakeFile.php
deleted file mode 100755
index c415989..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/FakeFile.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\File;
-
-use Symfony\Component\HttpFoundation\File\File as OrigFile;
-
-class FakeFile extends OrigFile
-{
- private $realpath;
-
- public function __construct($realpath, $path)
- {
- $this->realpath = $realpath;
- parent::__construct($path, false);
- }
-
- public function isReadable()
- {
- return true;
- }
-
- public function getRealpath()
- {
- return $this->realpath;
- }
-
- public function getSize()
- {
- return 42;
- }
-
- public function getMTime()
- {
- return time();
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/FileTest.php b/assets/php/vendor/symfony/http-foundation/Tests/File/FileTest.php
deleted file mode 100755
index dbd9c44..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/FileTest.php
+++ /dev/null
@@ -1,180 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\File;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\File\File;
-use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
-
-class FileTest extends TestCase
-{
- protected $file;
-
- public function testGetMimeTypeUsesMimeTypeGuessers()
- {
- $file = new File(__DIR__.'/Fixtures/test.gif');
- $guesser = $this->createMockGuesser($file->getPathname(), 'image/gif');
-
- MimeTypeGuesser::getInstance()->register($guesser);
-
- $this->assertEquals('image/gif', $file->getMimeType());
- }
-
- public function testGuessExtensionWithoutGuesser()
- {
- $file = new File(__DIR__.'/Fixtures/directory/.empty');
-
- $this->assertNull($file->guessExtension());
- }
-
- public function testGuessExtensionIsBasedOnMimeType()
- {
- $file = new File(__DIR__.'/Fixtures/test');
- $guesser = $this->createMockGuesser($file->getPathname(), 'image/gif');
-
- MimeTypeGuesser::getInstance()->register($guesser);
-
- $this->assertEquals('gif', $file->guessExtension());
- }
-
- /**
- * @requires extension fileinfo
- */
- public function testGuessExtensionWithReset()
- {
- $file = new File(__DIR__.'/Fixtures/other-file.example');
- $guesser = $this->createMockGuesser($file->getPathname(), 'image/gif');
- MimeTypeGuesser::getInstance()->register($guesser);
-
- $this->assertEquals('gif', $file->guessExtension());
-
- MimeTypeGuesser::reset();
-
- $this->assertNull($file->guessExtension());
- }
-
- public function testConstructWhenFileNotExists()
- {
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
-
- new File(__DIR__.'/Fixtures/not_here');
- }
-
- public function testMove()
- {
- $path = __DIR__.'/Fixtures/test.copy.gif';
- $targetDir = __DIR__.'/Fixtures/directory';
- $targetPath = $targetDir.'/test.copy.gif';
- @unlink($path);
- @unlink($targetPath);
- copy(__DIR__.'/Fixtures/test.gif', $path);
-
- $file = new File($path);
- $movedFile = $file->move($targetDir);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\File\File', $movedFile);
-
- $this->assertFileExists($targetPath);
- $this->assertFileNotExists($path);
- $this->assertEquals(realpath($targetPath), $movedFile->getRealPath());
-
- @unlink($targetPath);
- }
-
- public function testMoveWithNewName()
- {
- $path = __DIR__.'/Fixtures/test.copy.gif';
- $targetDir = __DIR__.'/Fixtures/directory';
- $targetPath = $targetDir.'/test.newname.gif';
- @unlink($path);
- @unlink($targetPath);
- copy(__DIR__.'/Fixtures/test.gif', $path);
-
- $file = new File($path);
- $movedFile = $file->move($targetDir, 'test.newname.gif');
-
- $this->assertFileExists($targetPath);
- $this->assertFileNotExists($path);
- $this->assertEquals(realpath($targetPath), $movedFile->getRealPath());
-
- @unlink($targetPath);
- }
-
- public function getFilenameFixtures()
- {
- return array(
- array('original.gif', 'original.gif'),
- array('..\\..\\original.gif', 'original.gif'),
- array('../../original.gif', 'original.gif'),
- array('файлfile.gif', 'файлfile.gif'),
- array('..\\..\\файлfile.gif', 'файлfile.gif'),
- array('../../файлfile.gif', 'файлfile.gif'),
- );
- }
-
- /**
- * @dataProvider getFilenameFixtures
- */
- public function testMoveWithNonLatinName($filename, $sanitizedFilename)
- {
- $path = __DIR__.'/Fixtures/'.$sanitizedFilename;
- $targetDir = __DIR__.'/Fixtures/directory/';
- $targetPath = $targetDir.$sanitizedFilename;
- @unlink($path);
- @unlink($targetPath);
- copy(__DIR__.'/Fixtures/test.gif', $path);
-
- $file = new File($path);
- $movedFile = $file->move($targetDir, $filename);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\File\File', $movedFile);
-
- $this->assertFileExists($targetPath);
- $this->assertFileNotExists($path);
- $this->assertEquals(realpath($targetPath), $movedFile->getRealPath());
-
- @unlink($targetPath);
- }
-
- public function testMoveToAnUnexistentDirectory()
- {
- $sourcePath = __DIR__.'/Fixtures/test.copy.gif';
- $targetDir = __DIR__.'/Fixtures/directory/sub';
- $targetPath = $targetDir.'/test.copy.gif';
- @unlink($sourcePath);
- @unlink($targetPath);
- @rmdir($targetDir);
- copy(__DIR__.'/Fixtures/test.gif', $sourcePath);
-
- $file = new File($sourcePath);
- $movedFile = $file->move($targetDir);
-
- $this->assertFileExists($targetPath);
- $this->assertFileNotExists($sourcePath);
- $this->assertEquals(realpath($targetPath), $movedFile->getRealPath());
-
- @unlink($sourcePath);
- @unlink($targetPath);
- @rmdir($targetDir);
- }
-
- protected function createMockGuesser($path, $mimeType)
- {
- $guesser = $this->getMockBuilder('Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface')->getMock();
- $guesser
- ->expects($this->once())
- ->method('guess')
- ->with($this->equalTo($path))
- ->will($this->returnValue($mimeType))
- ;
-
- return $guesser;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/.unknownextension b/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/.unknownextension
deleted file mode 100755
index 4d1ae35..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/.unknownextension
+++ /dev/null
@@ -1 +0,0 @@
-f \ No newline at end of file
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/directory/.empty b/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/directory/.empty
deleted file mode 100755
index e69de29..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/directory/.empty
+++ /dev/null
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/other-file.example b/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/other-file.example
deleted file mode 100755
index e69de29..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/other-file.example
+++ /dev/null
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/test b/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/test
deleted file mode 100755
index b636f4b..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/test
+++ /dev/null
Binary files differ
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/test.gif b/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/test.gif
deleted file mode 100755
index b636f4b..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/test.gif
+++ /dev/null
Binary files differ
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php b/assets/php/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php
deleted file mode 100755
index b3f1f02..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\File\MimeType;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
-use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser;
-
-/**
- * @requires extension fileinfo
- */
-class MimeTypeTest extends TestCase
-{
- protected $path;
-
- public function testGuessImageWithoutExtension()
- {
- $this->assertEquals('image/gif', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/test'));
- }
-
- public function testGuessImageWithDirectory()
- {
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
-
- MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/directory');
- }
-
- public function testGuessImageWithFileBinaryMimeTypeGuesser()
- {
- $guesser = MimeTypeGuesser::getInstance();
- $guesser->register(new FileBinaryMimeTypeGuesser());
- $this->assertEquals('image/gif', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/test'));
- }
-
- public function testGuessImageWithKnownExtension()
- {
- $this->assertEquals('image/gif', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/test.gif'));
- }
-
- public function testGuessFileWithUnknownExtension()
- {
- $this->assertEquals('application/octet-stream', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/.unknownextension'));
- }
-
- public function testGuessWithIncorrectPath()
- {
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
- MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/not_here');
- }
-
- public function testGuessWithNonReadablePath()
- {
- if ('\\' === DIRECTORY_SEPARATOR) {
- $this->markTestSkipped('Can not verify chmod operations on Windows');
- }
-
- if (!getenv('USER') || 'root' === getenv('USER')) {
- $this->markTestSkipped('This test will fail if run under superuser');
- }
-
- $path = __DIR__.'/../Fixtures/to_delete';
- touch($path);
- @chmod($path, 0333);
-
- if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) {
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException');
- MimeTypeGuesser::getInstance()->guess($path);
- } else {
- $this->markTestSkipped('Can not verify chmod operations, change of file permissions failed');
- }
- }
-
- public static function tearDownAfterClass()
- {
- $path = __DIR__.'/../Fixtures/to_delete';
- if (file_exists($path)) {
- @chmod($path, 0666);
- @unlink($path);
- }
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php b/assets/php/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php
deleted file mode 100755
index 36f122f..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php
+++ /dev/null
@@ -1,273 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\File;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\File\UploadedFile;
-
-class UploadedFileTest extends TestCase
-{
- protected function setUp()
- {
- if (!ini_get('file_uploads')) {
- $this->markTestSkipped('file_uploads is disabled in php.ini');
- }
- }
-
- public function testConstructWhenFileNotExists()
- {
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
-
- new UploadedFile(
- __DIR__.'/Fixtures/not_here',
- 'original.gif',
- null
- );
- }
-
- public function testFileUploadsWithNoMimeType()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- null,
- filesize(__DIR__.'/Fixtures/test.gif'),
- UPLOAD_ERR_OK
- );
-
- $this->assertEquals('application/octet-stream', $file->getClientMimeType());
-
- if (extension_loaded('fileinfo')) {
- $this->assertEquals('image/gif', $file->getMimeType());
- }
- }
-
- public function testFileUploadsWithUnknownMimeType()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/.unknownextension',
- 'original.gif',
- null,
- filesize(__DIR__.'/Fixtures/.unknownextension'),
- UPLOAD_ERR_OK
- );
-
- $this->assertEquals('application/octet-stream', $file->getClientMimeType());
- }
-
- public function testGuessClientExtension()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals('gif', $file->guessClientExtension());
- }
-
- public function testGuessClientExtensionWithIncorrectMimeType()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/jpeg',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals('jpeg', $file->guessClientExtension());
- }
-
- public function testErrorIsOkByDefault()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals(UPLOAD_ERR_OK, $file->getError());
- }
-
- public function testGetClientOriginalName()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals('original.gif', $file->getClientOriginalName());
- }
-
- public function testGetClientOriginalExtension()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals('gif', $file->getClientOriginalExtension());
- }
-
- /**
- * @expectedException \Symfony\Component\HttpFoundation\File\Exception\FileException
- */
- public function testMoveLocalFileIsNotAllowed()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- UPLOAD_ERR_OK
- );
-
- $movedFile = $file->move(__DIR__.'/Fixtures/directory');
- }
-
- public function testMoveLocalFileIsAllowedInTestMode()
- {
- $path = __DIR__.'/Fixtures/test.copy.gif';
- $targetDir = __DIR__.'/Fixtures/directory';
- $targetPath = $targetDir.'/test.copy.gif';
- @unlink($path);
- @unlink($targetPath);
- copy(__DIR__.'/Fixtures/test.gif', $path);
-
- $file = new UploadedFile(
- $path,
- 'original.gif',
- 'image/gif',
- filesize($path),
- UPLOAD_ERR_OK,
- true
- );
-
- $movedFile = $file->move(__DIR__.'/Fixtures/directory');
-
- $this->assertFileExists($targetPath);
- $this->assertFileNotExists($path);
- $this->assertEquals(realpath($targetPath), $movedFile->getRealPath());
-
- @unlink($targetPath);
- }
-
- public function testGetClientOriginalNameSanitizeFilename()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- '../../original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals('original.gif', $file->getClientOriginalName());
- }
-
- public function testGetSize()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals(filesize(__DIR__.'/Fixtures/test.gif'), $file->getSize());
-
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test',
- 'original.gif',
- 'image/gif'
- );
-
- $this->assertEquals(filesize(__DIR__.'/Fixtures/test'), $file->getSize());
- }
-
- public function testGetExtension()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- null
- );
-
- $this->assertEquals('gif', $file->getExtension());
- }
-
- public function testIsValid()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- null,
- filesize(__DIR__.'/Fixtures/test.gif'),
- UPLOAD_ERR_OK,
- true
- );
-
- $this->assertTrue($file->isValid());
- }
-
- /**
- * @dataProvider uploadedFileErrorProvider
- */
- public function testIsInvalidOnUploadError($error)
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- null,
- filesize(__DIR__.'/Fixtures/test.gif'),
- $error
- );
-
- $this->assertFalse($file->isValid());
- }
-
- public function uploadedFileErrorProvider()
- {
- return array(
- array(UPLOAD_ERR_INI_SIZE),
- array(UPLOAD_ERR_FORM_SIZE),
- array(UPLOAD_ERR_PARTIAL),
- array(UPLOAD_ERR_NO_TMP_DIR),
- array(UPLOAD_ERR_EXTENSION),
- );
- }
-
- public function testIsInvalidIfNotHttpUpload()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- null,
- filesize(__DIR__.'/Fixtures/test.gif'),
- UPLOAD_ERR_OK
- );
-
- $this->assertFalse($file->isValid());
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/FileBagTest.php b/assets/php/vendor/symfony/http-foundation/Tests/FileBagTest.php
deleted file mode 100755
index b1bbba0..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/FileBagTest.php
+++ /dev/null
@@ -1,175 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\File\UploadedFile;
-use Symfony\Component\HttpFoundation\FileBag;
-
-/**
- * FileBagTest.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- * @author Bulat Shakirzyanov <mallluhuct@gmail.com>
- */
-class FileBagTest extends TestCase
-{
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testFileMustBeAnArrayOrUploadedFile()
- {
- new FileBag(array('file' => 'foo'));
- }
-
- public function testShouldConvertsUploadedFiles()
- {
- $tmpFile = $this->createTempFile();
- $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0);
-
- $bag = new FileBag(array('file' => array(
- 'name' => basename($tmpFile),
- 'type' => 'text/plain',
- 'tmp_name' => $tmpFile,
- 'error' => 0,
- 'size' => 100,
- )));
-
- $this->assertEquals($file, $bag->get('file'));
- }
-
- public function testShouldSetEmptyUploadedFilesToNull()
- {
- $bag = new FileBag(array('file' => array(
- 'name' => '',
- 'type' => '',
- 'tmp_name' => '',
- 'error' => UPLOAD_ERR_NO_FILE,
- 'size' => 0,
- )));
-
- $this->assertNull($bag->get('file'));
- }
-
- public function testShouldRemoveEmptyUploadedFilesForMultiUpload()
- {
- $bag = new FileBag(array('files' => array(
- 'name' => array(''),
- 'type' => array(''),
- 'tmp_name' => array(''),
- 'error' => array(UPLOAD_ERR_NO_FILE),
- 'size' => array(0),
- )));
-
- $this->assertSame(array(), $bag->get('files'));
- }
-
- public function testShouldNotRemoveEmptyUploadedFilesForAssociativeArray()
- {
- $bag = new FileBag(array('files' => array(
- 'name' => array('file1' => ''),
- 'type' => array('file1' => ''),
- 'tmp_name' => array('file1' => ''),
- 'error' => array('file1' => UPLOAD_ERR_NO_FILE),
- 'size' => array('file1' => 0),
- )));
-
- $this->assertSame(array('file1' => null), $bag->get('files'));
- }
-
- public function testShouldConvertUploadedFilesWithPhpBug()
- {
- $tmpFile = $this->createTempFile();
- $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0);
-
- $bag = new FileBag(array(
- 'child' => array(
- 'name' => array(
- 'file' => basename($tmpFile),
- ),
- 'type' => array(
- 'file' => 'text/plain',
- ),
- 'tmp_name' => array(
- 'file' => $tmpFile,
- ),
- 'error' => array(
- 'file' => 0,
- ),
- 'size' => array(
- 'file' => 100,
- ),
- ),
- ));
-
- $files = $bag->all();
- $this->assertEquals($file, $files['child']['file']);
- }
-
- public function testShouldConvertNestedUploadedFilesWithPhpBug()
- {
- $tmpFile = $this->createTempFile();
- $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0);
-
- $bag = new FileBag(array(
- 'child' => array(
- 'name' => array(
- 'sub' => array('file' => basename($tmpFile)),
- ),
- 'type' => array(
- 'sub' => array('file' => 'text/plain'),
- ),
- 'tmp_name' => array(
- 'sub' => array('file' => $tmpFile),
- ),
- 'error' => array(
- 'sub' => array('file' => 0),
- ),
- 'size' => array(
- 'sub' => array('file' => 100),
- ),
- ),
- ));
-
- $files = $bag->all();
- $this->assertEquals($file, $files['child']['sub']['file']);
- }
-
- public function testShouldNotConvertNestedUploadedFiles()
- {
- $tmpFile = $this->createTempFile();
- $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0);
- $bag = new FileBag(array('image' => array('file' => $file)));
-
- $files = $bag->all();
- $this->assertEquals($file, $files['image']['file']);
- }
-
- protected function createTempFile()
- {
- return tempnam(sys_get_temp_dir().'/form_test', 'FormTest');
- }
-
- protected function setUp()
- {
- mkdir(sys_get_temp_dir().'/form_test', 0777, true);
- }
-
- protected function tearDown()
- {
- foreach (glob(sys_get_temp_dir().'/form_test/*') as $file) {
- unlink($file);
- }
-
- rmdir(sys_get_temp_dir().'/form_test');
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/HeaderBagTest.php b/assets/php/vendor/symfony/http-foundation/Tests/HeaderBagTest.php
deleted file mode 100755
index 6d19ceb..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/HeaderBagTest.php
+++ /dev/null
@@ -1,205 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\HeaderBag;
-
-class HeaderBagTest extends TestCase
-{
- public function testConstructor()
- {
- $bag = new HeaderBag(array('foo' => 'bar'));
- $this->assertTrue($bag->has('foo'));
- }
-
- public function testToStringNull()
- {
- $bag = new HeaderBag();
- $this->assertEquals('', $bag->__toString());
- }
-
- public function testToStringNotNull()
- {
- $bag = new HeaderBag(array('foo' => 'bar'));
- $this->assertEquals("Foo: bar\r\n", $bag->__toString());
- }
-
- public function testKeys()
- {
- $bag = new HeaderBag(array('foo' => 'bar'));
- $keys = $bag->keys();
- $this->assertEquals('foo', $keys[0]);
- }
-
- public function testGetDate()
- {
- $bag = new HeaderBag(array('foo' => 'Tue, 4 Sep 2012 20:00:00 +0200'));
- $headerDate = $bag->getDate('foo');
- $this->assertInstanceOf('DateTime', $headerDate);
- }
-
- /**
- * @expectedException \RuntimeException
- */
- public function testGetDateException()
- {
- $bag = new HeaderBag(array('foo' => 'Tue'));
- $headerDate = $bag->getDate('foo');
- }
-
- public function testGetCacheControlHeader()
- {
- $bag = new HeaderBag();
- $bag->addCacheControlDirective('public', '#a');
- $this->assertTrue($bag->hasCacheControlDirective('public'));
- $this->assertEquals('#a', $bag->getCacheControlDirective('public'));
- }
-
- public function testAll()
- {
- $bag = new HeaderBag(array('foo' => 'bar'));
- $this->assertEquals(array('foo' => array('bar')), $bag->all(), '->all() gets all the input');
-
- $bag = new HeaderBag(array('FOO' => 'BAR'));
- $this->assertEquals(array('foo' => array('BAR')), $bag->all(), '->all() gets all the input key are lower case');
- }
-
- public function testReplace()
- {
- $bag = new HeaderBag(array('foo' => 'bar'));
-
- $bag->replace(array('NOPE' => 'BAR'));
- $this->assertEquals(array('nope' => array('BAR')), $bag->all(), '->replace() replaces the input with the argument');
- $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input');
- }
-
- public function testGet()
- {
- $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz'));
- $this->assertEquals('bar', $bag->get('foo'), '->get return current value');
- $this->assertEquals('bar', $bag->get('FoO'), '->get key in case insensitive');
- $this->assertEquals(array('bar'), $bag->get('foo', 'nope', false), '->get return the value as array');
-
- // defaults
- $this->assertNull($bag->get('none'), '->get unknown values returns null');
- $this->assertEquals('default', $bag->get('none', 'default'), '->get unknown values returns default');
- $this->assertEquals(array('default'), $bag->get('none', 'default', false), '->get unknown values returns default as array');
-
- $bag->set('foo', 'bor', false);
- $this->assertEquals('bar', $bag->get('foo'), '->get return first value');
- $this->assertEquals(array('bar', 'bor'), $bag->get('foo', 'nope', false), '->get return all values as array');
- }
-
- public function testSetAssociativeArray()
- {
- $bag = new HeaderBag();
- $bag->set('foo', array('bad-assoc-index' => 'value'));
- $this->assertSame('value', $bag->get('foo'));
- $this->assertEquals(array('value'), $bag->get('foo', 'nope', false), 'assoc indices of multi-valued headers are ignored');
- }
-
- public function testContains()
- {
- $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz'));
- $this->assertTrue($bag->contains('foo', 'bar'), '->contains first value');
- $this->assertTrue($bag->contains('fuzz', 'bizz'), '->contains second value');
- $this->assertFalse($bag->contains('nope', 'nope'), '->contains unknown value');
- $this->assertFalse($bag->contains('foo', 'nope'), '->contains unknown value');
-
- // Multiple values
- $bag->set('foo', 'bor', false);
- $this->assertTrue($bag->contains('foo', 'bar'), '->contains first value');
- $this->assertTrue($bag->contains('foo', 'bor'), '->contains second value');
- $this->assertFalse($bag->contains('foo', 'nope'), '->contains unknown value');
- }
-
- public function testCacheControlDirectiveAccessors()
- {
- $bag = new HeaderBag();
- $bag->addCacheControlDirective('public');
-
- $this->assertTrue($bag->hasCacheControlDirective('public'));
- $this->assertTrue($bag->getCacheControlDirective('public'));
- $this->assertEquals('public', $bag->get('cache-control'));
-
- $bag->addCacheControlDirective('max-age', 10);
- $this->assertTrue($bag->hasCacheControlDirective('max-age'));
- $this->assertEquals(10, $bag->getCacheControlDirective('max-age'));
- $this->assertEquals('max-age=10, public', $bag->get('cache-control'));
-
- $bag->removeCacheControlDirective('max-age');
- $this->assertFalse($bag->hasCacheControlDirective('max-age'));
- }
-
- public function testCacheControlDirectiveParsing()
- {
- $bag = new HeaderBag(array('cache-control' => 'public, max-age=10'));
- $this->assertTrue($bag->hasCacheControlDirective('public'));
- $this->assertTrue($bag->getCacheControlDirective('public'));
-
- $this->assertTrue($bag->hasCacheControlDirective('max-age'));
- $this->assertEquals(10, $bag->getCacheControlDirective('max-age'));
-
- $bag->addCacheControlDirective('s-maxage', 100);
- $this->assertEquals('max-age=10, public, s-maxage=100', $bag->get('cache-control'));
- }
-
- public function testCacheControlDirectiveParsingQuotedZero()
- {
- $bag = new HeaderBag(array('cache-control' => 'max-age="0"'));
- $this->assertTrue($bag->hasCacheControlDirective('max-age'));
- $this->assertEquals(0, $bag->getCacheControlDirective('max-age'));
- }
-
- public function testCacheControlDirectiveOverrideWithReplace()
- {
- $bag = new HeaderBag(array('cache-control' => 'private, max-age=100'));
- $bag->replace(array('cache-control' => 'public, max-age=10'));
- $this->assertTrue($bag->hasCacheControlDirective('public'));
- $this->assertTrue($bag->getCacheControlDirective('public'));
-
- $this->assertTrue($bag->hasCacheControlDirective('max-age'));
- $this->assertEquals(10, $bag->getCacheControlDirective('max-age'));
- }
-
- public function testCacheControlClone()
- {
- $headers = array('foo' => 'bar');
- $bag1 = new HeaderBag($headers);
- $bag2 = new HeaderBag($bag1->all());
-
- $this->assertEquals($bag1->all(), $bag2->all());
- }
-
- public function testGetIterator()
- {
- $headers = array('foo' => 'bar', 'hello' => 'world', 'third' => 'charm');
- $headerBag = new HeaderBag($headers);
-
- $i = 0;
- foreach ($headerBag as $key => $val) {
- ++$i;
- $this->assertEquals(array($headers[$key]), $val);
- }
-
- $this->assertEquals(count($headers), $i);
- }
-
- public function testCount()
- {
- $headers = array('foo' => 'bar', 'HELLO' => 'WORLD');
- $headerBag = new HeaderBag($headers);
-
- $this->assertCount(count($headers), $headerBag);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/IpUtilsTest.php b/assets/php/vendor/symfony/http-foundation/Tests/IpUtilsTest.php
deleted file mode 100755
index 7a93f99..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/IpUtilsTest.php
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\IpUtils;
-
-class IpUtilsTest extends TestCase
-{
- /**
- * @dataProvider getIpv4Data
- */
- public function testIpv4($matches, $remoteAddr, $cidr)
- {
- $this->assertSame($matches, IpUtils::checkIp($remoteAddr, $cidr));
- }
-
- public function getIpv4Data()
- {
- return array(
- array(true, '192.168.1.1', '192.168.1.1'),
- array(true, '192.168.1.1', '192.168.1.1/1'),
- array(true, '192.168.1.1', '192.168.1.0/24'),
- array(false, '192.168.1.1', '1.2.3.4/1'),
- array(false, '192.168.1.1', '192.168.1.1/33'), // invalid subnet
- array(true, '192.168.1.1', array('1.2.3.4/1', '192.168.1.0/24')),
- array(true, '192.168.1.1', array('192.168.1.0/24', '1.2.3.4/1')),
- array(false, '192.168.1.1', array('1.2.3.4/1', '4.3.2.1/1')),
- array(true, '1.2.3.4', '0.0.0.0/0'),
- array(true, '1.2.3.4', '192.168.1.0/0'),
- array(false, '1.2.3.4', '256.256.256/0'), // invalid CIDR notation
- array(false, 'an_invalid_ip', '192.168.1.0/24'),
- );
- }
-
- /**
- * @dataProvider getIpv6Data
- */
- public function testIpv6($matches, $remoteAddr, $cidr)
- {
- if (!defined('AF_INET6')) {
- $this->markTestSkipped('Only works when PHP is compiled without the option "disable-ipv6".');
- }
-
- $this->assertSame($matches, IpUtils::checkIp($remoteAddr, $cidr));
- }
-
- public function getIpv6Data()
- {
- return array(
- array(true, '2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'),
- array(false, '2a00:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'),
- array(false, '2a01:198:603:0:396e:4789:8e99:890f', '::1'),
- array(true, '0:0:0:0:0:0:0:1', '::1'),
- array(false, '0:0:603:0:396e:4789:8e99:0001', '::1'),
- array(true, '0:0:603:0:396e:4789:8e99:0001', '::/0'),
- array(true, '0:0:603:0:396e:4789:8e99:0001', '2a01:198:603:0::/0'),
- array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '2a01:198:603:0::/65')),
- array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('2a01:198:603:0::/65', '::1')),
- array(false, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '1a01:198:603:0::/65')),
- array(false, '}__test|O:21:&quot;JDatabaseDriverMysqli&quot;:3:{s:2', '::1'),
- array(false, '2a01:198:603:0:396e:4789:8e99:890f', 'unknown'),
- );
- }
-
- /**
- * @expectedException \RuntimeException
- * @requires extension sockets
- */
- public function testAnIpv6WithOptionDisabledIpv6()
- {
- if (defined('AF_INET6')) {
- $this->markTestSkipped('Only works when PHP is compiled with the option "disable-ipv6".');
- }
-
- IpUtils::checkIp('2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65');
- }
-
- /**
- * @dataProvider invalidIpAddressData
- */
- public function testInvalidIpAddressesDoNotMatch($requestIp, $proxyIp)
- {
- $this->assertFalse(IpUtils::checkIp4($requestIp, $proxyIp));
- }
-
- public function invalidIpAddressData()
- {
- return array(
- 'invalid proxy wildcard' => array('192.168.20.13', '*'),
- 'invalid proxy missing netmask' => array('192.168.20.13', '0.0.0.0'),
- 'invalid request IP with invalid proxy wildcard' => array('0.0.0.0', '*'),
- );
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/JsonResponseTest.php b/assets/php/vendor/symfony/http-foundation/Tests/JsonResponseTest.php
deleted file mode 100755
index 201839f..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/JsonResponseTest.php
+++ /dev/null
@@ -1,257 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\JsonResponse;
-
-class JsonResponseTest extends TestCase
-{
- public function testConstructorEmptyCreatesJsonObject()
- {
- $response = new JsonResponse();
- $this->assertSame('{}', $response->getContent());
- }
-
- public function testConstructorWithArrayCreatesJsonArray()
- {
- $response = new JsonResponse(array(0, 1, 2, 3));
- $this->assertSame('[0,1,2,3]', $response->getContent());
- }
-
- public function testConstructorWithAssocArrayCreatesJsonObject()
- {
- $response = new JsonResponse(array('foo' => 'bar'));
- $this->assertSame('{"foo":"bar"}', $response->getContent());
- }
-
- public function testConstructorWithSimpleTypes()
- {
- $response = new JsonResponse('foo');
- $this->assertSame('"foo"', $response->getContent());
-
- $response = new JsonResponse(0);
- $this->assertSame('0', $response->getContent());
-
- $response = new JsonResponse(0.1);
- $this->assertSame('0.1', $response->getContent());
-
- $response = new JsonResponse(true);
- $this->assertSame('true', $response->getContent());
- }
-
- public function testConstructorWithCustomStatus()
- {
- $response = new JsonResponse(array(), 202);
- $this->assertSame(202, $response->getStatusCode());
- }
-
- public function testConstructorAddsContentTypeHeader()
- {
- $response = new JsonResponse();
- $this->assertSame('application/json', $response->headers->get('Content-Type'));
- }
-
- public function testConstructorWithCustomHeaders()
- {
- $response = new JsonResponse(array(), 200, array('ETag' => 'foo'));
- $this->assertSame('application/json', $response->headers->get('Content-Type'));
- $this->assertSame('foo', $response->headers->get('ETag'));
- }
-
- public function testConstructorWithCustomContentType()
- {
- $headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json');
-
- $response = new JsonResponse(array(), 200, $headers);
- $this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type'));
- }
-
- public function testSetJson()
- {
- $response = new JsonResponse('1', 200, array(), true);
- $this->assertEquals('1', $response->getContent());
-
- $response = new JsonResponse('[1]', 200, array(), true);
- $this->assertEquals('[1]', $response->getContent());
-
- $response = new JsonResponse(null, 200, array());
- $response->setJson('true');
- $this->assertEquals('true', $response->getContent());
- }
-
- public function testCreate()
- {
- $response = JsonResponse::create(array('foo' => 'bar'), 204);
-
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertEquals('{"foo":"bar"}', $response->getContent());
- $this->assertEquals(204, $response->getStatusCode());
- }
-
- public function testStaticCreateEmptyJsonObject()
- {
- $response = JsonResponse::create();
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('{}', $response->getContent());
- }
-
- public function testStaticCreateJsonArray()
- {
- $response = JsonResponse::create(array(0, 1, 2, 3));
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('[0,1,2,3]', $response->getContent());
- }
-
- public function testStaticCreateJsonObject()
- {
- $response = JsonResponse::create(array('foo' => 'bar'));
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('{"foo":"bar"}', $response->getContent());
- }
-
- public function testStaticCreateWithSimpleTypes()
- {
- $response = JsonResponse::create('foo');
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('"foo"', $response->getContent());
-
- $response = JsonResponse::create(0);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('0', $response->getContent());
-
- $response = JsonResponse::create(0.1);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('0.1', $response->getContent());
-
- $response = JsonResponse::create(true);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('true', $response->getContent());
- }
-
- public function testStaticCreateWithCustomStatus()
- {
- $response = JsonResponse::create(array(), 202);
- $this->assertSame(202, $response->getStatusCode());
- }
-
- public function testStaticCreateAddsContentTypeHeader()
- {
- $response = JsonResponse::create();
- $this->assertSame('application/json', $response->headers->get('Content-Type'));
- }
-
- public function testStaticCreateWithCustomHeaders()
- {
- $response = JsonResponse::create(array(), 200, array('ETag' => 'foo'));
- $this->assertSame('application/json', $response->headers->get('Content-Type'));
- $this->assertSame('foo', $response->headers->get('ETag'));
- }
-
- public function testStaticCreateWithCustomContentType()
- {
- $headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json');
-
- $response = JsonResponse::create(array(), 200, $headers);
- $this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type'));
- }
-
- public function testSetCallback()
- {
- $response = JsonResponse::create(array('foo' => 'bar'))->setCallback('callback');
-
- $this->assertEquals('/**/callback({"foo":"bar"});', $response->getContent());
- $this->assertEquals('text/javascript', $response->headers->get('Content-Type'));
- }
-
- public function testJsonEncodeFlags()
- {
- $response = new JsonResponse('<>\'&"');
-
- $this->assertEquals('"\u003C\u003E\u0027\u0026\u0022"', $response->getContent());
- }
-
- public function testGetEncodingOptions()
- {
- $response = new JsonResponse();
-
- $this->assertEquals(JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT, $response->getEncodingOptions());
- }
-
- public function testSetEncodingOptions()
- {
- $response = new JsonResponse();
- $response->setData(array(array(1, 2, 3)));
-
- $this->assertEquals('[[1,2,3]]', $response->getContent());
-
- $response->setEncodingOptions(JSON_FORCE_OBJECT);
-
- $this->assertEquals('{"0":{"0":1,"1":2,"2":3}}', $response->getContent());
- }
-
- public function testItAcceptsJsonAsString()
- {
- $response = JsonResponse::fromJsonString('{"foo":"bar"}');
- $this->assertSame('{"foo":"bar"}', $response->getContent());
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testSetCallbackInvalidIdentifier()
- {
- $response = new JsonResponse('foo');
- $response->setCallback('+invalid');
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testSetContent()
- {
- JsonResponse::create("\xB1\x31");
- }
-
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage This error is expected
- */
- public function testSetContentJsonSerializeError()
- {
- if (!interface_exists('JsonSerializable', false)) {
- $this->markTestSkipped('JsonSerializable is required.');
- }
-
- $serializable = new JsonSerializableObject();
-
- JsonResponse::create($serializable);
- }
-
- public function testSetComplexCallback()
- {
- $response = JsonResponse::create(array('foo' => 'bar'));
- $response->setCallback('ಠ_ಠ["foo"].bar[0]');
-
- $this->assertEquals('/**/ಠ_ಠ["foo"].bar[0]({"foo":"bar"});', $response->getContent());
- }
-}
-
-if (interface_exists('JsonSerializable', false)) {
- class JsonSerializableObject implements \JsonSerializable
- {
- public function jsonSerialize()
- {
- throw new \Exception('This error is expected');
- }
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/ParameterBagTest.php b/assets/php/vendor/symfony/http-foundation/Tests/ParameterBagTest.php
deleted file mode 100755
index ab908d8..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/ParameterBagTest.php
+++ /dev/null
@@ -1,194 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\ParameterBag;
-
-class ParameterBagTest extends TestCase
-{
- public function testConstructor()
- {
- $this->testAll();
- }
-
- public function testAll()
- {
- $bag = new ParameterBag(array('foo' => 'bar'));
- $this->assertEquals(array('foo' => 'bar'), $bag->all(), '->all() gets all the input');
- }
-
- public function testKeys()
- {
- $bag = new ParameterBag(array('foo' => 'bar'));
- $this->assertEquals(array('foo'), $bag->keys());
- }
-
- public function testAdd()
- {
- $bag = new ParameterBag(array('foo' => 'bar'));
- $bag->add(array('bar' => 'bas'));
- $this->assertEquals(array('foo' => 'bar', 'bar' => 'bas'), $bag->all());
- }
-
- public function testRemove()
- {
- $bag = new ParameterBag(array('foo' => 'bar'));
- $bag->add(array('bar' => 'bas'));
- $this->assertEquals(array('foo' => 'bar', 'bar' => 'bas'), $bag->all());
- $bag->remove('bar');
- $this->assertEquals(array('foo' => 'bar'), $bag->all());
- }
-
- public function testReplace()
- {
- $bag = new ParameterBag(array('foo' => 'bar'));
-
- $bag->replace(array('FOO' => 'BAR'));
- $this->assertEquals(array('FOO' => 'BAR'), $bag->all(), '->replace() replaces the input with the argument');
- $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input');
- }
-
- public function testGet()
- {
- $bag = new ParameterBag(array('foo' => 'bar', 'null' => null));
-
- $this->assertEquals('bar', $bag->get('foo'), '->get() gets the value of a parameter');
- $this->assertEquals('default', $bag->get('unknown', 'default'), '->get() returns second argument as default if a parameter is not defined');
- $this->assertNull($bag->get('null', 'default'), '->get() returns null if null is set');
- }
-
- public function testGetDoesNotUseDeepByDefault()
- {
- $bag = new ParameterBag(array('foo' => array('bar' => 'moo')));
-
- $this->assertNull($bag->get('foo[bar]'));
- }
-
- public function testSet()
- {
- $bag = new ParameterBag(array());
-
- $bag->set('foo', 'bar');
- $this->assertEquals('bar', $bag->get('foo'), '->set() sets the value of parameter');
-
- $bag->set('foo', 'baz');
- $this->assertEquals('baz', $bag->get('foo'), '->set() overrides previously set parameter');
- }
-
- public function testHas()
- {
- $bag = new ParameterBag(array('foo' => 'bar'));
-
- $this->assertTrue($bag->has('foo'), '->has() returns true if a parameter is defined');
- $this->assertFalse($bag->has('unknown'), '->has() return false if a parameter is not defined');
- }
-
- public function testGetAlpha()
- {
- $bag = new ParameterBag(array('word' => 'foo_BAR_012'));
-
- $this->assertEquals('fooBAR', $bag->getAlpha('word'), '->getAlpha() gets only alphabetic characters');
- $this->assertEquals('', $bag->getAlpha('unknown'), '->getAlpha() returns empty string if a parameter is not defined');
- }
-
- public function testGetAlnum()
- {
- $bag = new ParameterBag(array('word' => 'foo_BAR_012'));
-
- $this->assertEquals('fooBAR012', $bag->getAlnum('word'), '->getAlnum() gets only alphanumeric characters');
- $this->assertEquals('', $bag->getAlnum('unknown'), '->getAlnum() returns empty string if a parameter is not defined');
- }
-
- public function testGetDigits()
- {
- $bag = new ParameterBag(array('word' => 'foo_BAR_012'));
-
- $this->assertEquals('012', $bag->getDigits('word'), '->getDigits() gets only digits as string');
- $this->assertEquals('', $bag->getDigits('unknown'), '->getDigits() returns empty string if a parameter is not defined');
- }
-
- public function testGetInt()
- {
- $bag = new ParameterBag(array('digits' => '0123'));
-
- $this->assertEquals(123, $bag->getInt('digits'), '->getInt() gets a value of parameter as integer');
- $this->assertEquals(0, $bag->getInt('unknown'), '->getInt() returns zero if a parameter is not defined');
- }
-
- public function testFilter()
- {
- $bag = new ParameterBag(array(
- 'digits' => '0123ab',
- 'email' => 'example@example.com',
- 'url' => 'http://example.com/foo',
- 'dec' => '256',
- 'hex' => '0x100',
- 'array' => array('bang'),
- ));
-
- $this->assertEmpty($bag->filter('nokey'), '->filter() should return empty by default if no key is found');
-
- $this->assertEquals('0123', $bag->filter('digits', '', FILTER_SANITIZE_NUMBER_INT), '->filter() gets a value of parameter as integer filtering out invalid characters');
-
- $this->assertEquals('example@example.com', $bag->filter('email', '', FILTER_VALIDATE_EMAIL), '->filter() gets a value of parameter as email');
-
- $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, array('flags' => FILTER_FLAG_PATH_REQUIRED)), '->filter() gets a value of parameter as URL with a path');
-
- // This test is repeated for code-coverage
- $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED), '->filter() gets a value of parameter as URL with a path');
-
- $this->assertFalse($bag->filter('dec', '', FILTER_VALIDATE_INT, array(
- 'flags' => FILTER_FLAG_ALLOW_HEX,
- 'options' => array('min_range' => 1, 'max_range' => 0xff),
- )), '->filter() gets a value of parameter as integer between boundaries');
-
- $this->assertFalse($bag->filter('hex', '', FILTER_VALIDATE_INT, array(
- 'flags' => FILTER_FLAG_ALLOW_HEX,
- 'options' => array('min_range' => 1, 'max_range' => 0xff),
- )), '->filter() gets a value of parameter as integer between boundaries');
-
- $this->assertEquals(array('bang'), $bag->filter('array', ''), '->filter() gets a value of parameter as an array');
- }
-
- public function testGetIterator()
- {
- $parameters = array('foo' => 'bar', 'hello' => 'world');
- $bag = new ParameterBag($parameters);
-
- $i = 0;
- foreach ($bag as $key => $val) {
- ++$i;
- $this->assertEquals($parameters[$key], $val);
- }
-
- $this->assertEquals(count($parameters), $i);
- }
-
- public function testCount()
- {
- $parameters = array('foo' => 'bar', 'hello' => 'world');
- $bag = new ParameterBag($parameters);
-
- $this->assertCount(count($parameters), $bag);
- }
-
- public function testGetBoolean()
- {
- $parameters = array('string_true' => 'true', 'string_false' => 'false');
- $bag = new ParameterBag($parameters);
-
- $this->assertTrue($bag->getBoolean('string_true'), '->getBoolean() gets the string true as boolean true');
- $this->assertFalse($bag->getBoolean('string_false'), '->getBoolean() gets the string false as boolean false');
- $this->assertFalse($bag->getBoolean('unknown'), '->getBoolean() returns false if a parameter is not defined');
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php b/assets/php/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php
deleted file mode 100755
index d389e83..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\RedirectResponse;
-
-class RedirectResponseTest extends TestCase
-{
- public function testGenerateMetaRedirect()
- {
- $response = new RedirectResponse('foo.bar');
-
- $this->assertEquals(1, preg_match(
- '#<meta http-equiv="refresh" content="\d+;url=foo\.bar" />#',
- preg_replace(array('/\s+/', '/\'/'), array(' ', '"'), $response->getContent())
- ));
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testRedirectResponseConstructorNullUrl()
- {
- $response = new RedirectResponse(null);
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testRedirectResponseConstructorWrongStatusCode()
- {
- $response = new RedirectResponse('foo.bar', 404);
- }
-
- public function testGenerateLocationHeader()
- {
- $response = new RedirectResponse('foo.bar');
-
- $this->assertTrue($response->headers->has('Location'));
- $this->assertEquals('foo.bar', $response->headers->get('Location'));
- }
-
- public function testGetTargetUrl()
- {
- $response = new RedirectResponse('foo.bar');
-
- $this->assertEquals('foo.bar', $response->getTargetUrl());
- }
-
- public function testSetTargetUrl()
- {
- $response = new RedirectResponse('foo.bar');
- $response->setTargetUrl('baz.beep');
-
- $this->assertEquals('baz.beep', $response->getTargetUrl());
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testSetTargetUrlNull()
- {
- $response = new RedirectResponse('foo.bar');
- $response->setTargetUrl(null);
- }
-
- public function testCreate()
- {
- $response = RedirectResponse::create('foo', 301);
-
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\RedirectResponse', $response);
- $this->assertEquals(301, $response->getStatusCode());
- }
-
- public function testCacheHeaders()
- {
- $response = new RedirectResponse('foo.bar', 301);
- $this->assertFalse($response->headers->hasCacheControlDirective('no-cache'));
-
- $response = new RedirectResponse('foo.bar', 301, array('cache-control' => 'max-age=86400'));
- $this->assertFalse($response->headers->hasCacheControlDirective('no-cache'));
- $this->assertTrue($response->headers->hasCacheControlDirective('max-age'));
-
- $response = new RedirectResponse('foo.bar', 302);
- $this->assertTrue($response->headers->hasCacheControlDirective('no-cache'));
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php b/assets/php/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php
deleted file mode 100755
index b5d8004..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php
+++ /dev/null
@@ -1,151 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\RequestMatcher;
-use Symfony\Component\HttpFoundation\Request;
-
-class RequestMatcherTest extends TestCase
-{
- /**
- * @dataProvider getMethodData
- */
- public function testMethod($requestMethod, $matcherMethod, $isMatch)
- {
- $matcher = new RequestMatcher();
- $matcher->matchMethod($matcherMethod);
- $request = Request::create('', $requestMethod);
- $this->assertSame($isMatch, $matcher->matches($request));
-
- $matcher = new RequestMatcher(null, null, $matcherMethod);
- $request = Request::create('', $requestMethod);
- $this->assertSame($isMatch, $matcher->matches($request));
- }
-
- public function getMethodData()
- {
- return array(
- array('get', 'get', true),
- array('get', array('get', 'post'), true),
- array('get', 'post', false),
- array('get', 'GET', true),
- array('get', array('GET', 'POST'), true),
- array('get', 'POST', false),
- );
- }
-
- public function testScheme()
- {
- $httpRequest = $request = $request = Request::create('');
- $httpsRequest = $request = $request = Request::create('', 'get', array(), array(), array(), array('HTTPS' => 'on'));
-
- $matcher = new RequestMatcher();
- $matcher->matchScheme('https');
- $this->assertFalse($matcher->matches($httpRequest));
- $this->assertTrue($matcher->matches($httpsRequest));
-
- $matcher->matchScheme('http');
- $this->assertFalse($matcher->matches($httpsRequest));
- $this->assertTrue($matcher->matches($httpRequest));
-
- $matcher = new RequestMatcher();
- $this->assertTrue($matcher->matches($httpsRequest));
- $this->assertTrue($matcher->matches($httpRequest));
- }
-
- /**
- * @dataProvider getHostData
- */
- public function testHost($pattern, $isMatch)
- {
- $matcher = new RequestMatcher();
- $request = Request::create('', 'get', array(), array(), array(), array('HTTP_HOST' => 'foo.example.com'));
-
- $matcher->matchHost($pattern);
- $this->assertSame($isMatch, $matcher->matches($request));
-
- $matcher = new RequestMatcher(null, $pattern);
- $this->assertSame($isMatch, $matcher->matches($request));
- }
-
- public function getHostData()
- {
- return array(
- array('.*\.example\.com', true),
- array('\.example\.com$', true),
- array('^.*\.example\.com$', true),
- array('.*\.sensio\.com', false),
- array('.*\.example\.COM', true),
- array('\.example\.COM$', true),
- array('^.*\.example\.COM$', true),
- array('.*\.sensio\.COM', false),
- );
- }
-
- public function testPath()
- {
- $matcher = new RequestMatcher();
-
- $request = Request::create('/admin/foo');
-
- $matcher->matchPath('/admin/.*');
- $this->assertTrue($matcher->matches($request));
-
- $matcher->matchPath('/admin');
- $this->assertTrue($matcher->matches($request));
-
- $matcher->matchPath('^/admin/.*$');
- $this->assertTrue($matcher->matches($request));
-
- $matcher->matchMethod('/blog/.*');
- $this->assertFalse($matcher->matches($request));
- }
-
- public function testPathWithLocaleIsNotSupported()
- {
- $matcher = new RequestMatcher();
- $request = Request::create('/en/login');
- $request->setLocale('en');
-
- $matcher->matchPath('^/{_locale}/login$');
- $this->assertFalse($matcher->matches($request));
- }
-
- public function testPathWithEncodedCharacters()
- {
- $matcher = new RequestMatcher();
- $request = Request::create('/admin/fo%20o');
- $matcher->matchPath('^/admin/fo o*$');
- $this->assertTrue($matcher->matches($request));
- }
-
- public function testAttributes()
- {
- $matcher = new RequestMatcher();
-
- $request = Request::create('/admin/foo');
- $request->attributes->set('foo', 'foo_bar');
-
- $matcher->matchAttribute('foo', 'foo_.*');
- $this->assertTrue($matcher->matches($request));
-
- $matcher->matchAttribute('foo', 'foo');
- $this->assertTrue($matcher->matches($request));
-
- $matcher->matchAttribute('foo', '^foo_bar$');
- $this->assertTrue($matcher->matches($request));
-
- $matcher->matchAttribute('foo', 'babar');
- $this->assertFalse($matcher->matches($request));
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/RequestStackTest.php b/assets/php/vendor/symfony/http-foundation/Tests/RequestStackTest.php
deleted file mode 100755
index a84fb26..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/RequestStackTest.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\RequestStack;
-
-class RequestStackTest extends TestCase
-{
- public function testGetCurrentRequest()
- {
- $requestStack = new RequestStack();
- $this->assertNull($requestStack->getCurrentRequest());
-
- $request = Request::create('/foo');
-
- $requestStack->push($request);
- $this->assertSame($request, $requestStack->getCurrentRequest());
-
- $this->assertSame($request, $requestStack->pop());
- $this->assertNull($requestStack->getCurrentRequest());
-
- $this->assertNull($requestStack->pop());
- }
-
- public function testGetMasterRequest()
- {
- $requestStack = new RequestStack();
- $this->assertNull($requestStack->getMasterRequest());
-
- $masterRequest = Request::create('/foo');
- $subRequest = Request::create('/bar');
-
- $requestStack->push($masterRequest);
- $requestStack->push($subRequest);
-
- $this->assertSame($masterRequest, $requestStack->getMasterRequest());
- }
-
- public function testGetParentRequest()
- {
- $requestStack = new RequestStack();
- $this->assertNull($requestStack->getParentRequest());
-
- $masterRequest = Request::create('/foo');
-
- $requestStack->push($masterRequest);
- $this->assertNull($requestStack->getParentRequest());
-
- $firstSubRequest = Request::create('/bar');
-
- $requestStack->push($firstSubRequest);
- $this->assertSame($masterRequest, $requestStack->getParentRequest());
-
- $secondSubRequest = Request::create('/baz');
-
- $requestStack->push($secondSubRequest);
- $this->assertSame($firstSubRequest, $requestStack->getParentRequest());
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/RequestTest.php b/assets/php/vendor/symfony/http-foundation/Tests/RequestTest.php
deleted file mode 100755
index 230ad15..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/RequestTest.php
+++ /dev/null
@@ -1,2329 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
-use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
-use Symfony\Component\HttpFoundation\Session\Session;
-use Symfony\Component\HttpFoundation\Request;
-
-class RequestTest extends TestCase
-{
- protected function tearDown()
- {
- // reset
- Request::setTrustedProxies(array(), -1);
- }
-
- public function testInitialize()
- {
- $request = new Request();
-
- $request->initialize(array('foo' => 'bar'));
- $this->assertEquals('bar', $request->query->get('foo'), '->initialize() takes an array of query parameters as its first argument');
-
- $request->initialize(array(), array('foo' => 'bar'));
- $this->assertEquals('bar', $request->request->get('foo'), '->initialize() takes an array of request parameters as its second argument');
-
- $request->initialize(array(), array(), array('foo' => 'bar'));
- $this->assertEquals('bar', $request->attributes->get('foo'), '->initialize() takes an array of attributes as its third argument');
-
- $request->initialize(array(), array(), array(), array(), array(), array('HTTP_FOO' => 'bar'));
- $this->assertEquals('bar', $request->headers->get('FOO'), '->initialize() takes an array of HTTP headers as its sixth argument');
- }
-
- public function testGetLocale()
- {
- $request = new Request();
- $request->setLocale('pl');
- $locale = $request->getLocale();
- $this->assertEquals('pl', $locale);
- }
-
- public function testGetUser()
- {
- $request = Request::create('http://user:password@test.com');
- $user = $request->getUser();
-
- $this->assertEquals('user', $user);
- }
-
- public function testGetPassword()
- {
- $request = Request::create('http://user:password@test.com');
- $password = $request->getPassword();
-
- $this->assertEquals('password', $password);
- }
-
- public function testIsNoCache()
- {
- $request = new Request();
- $isNoCache = $request->isNoCache();
-
- $this->assertFalse($isNoCache);
- }
-
- public function testGetContentType()
- {
- $request = new Request();
- $contentType = $request->getContentType();
-
- $this->assertNull($contentType);
- }
-
- public function testSetDefaultLocale()
- {
- $request = new Request();
- $request->setDefaultLocale('pl');
- $locale = $request->getLocale();
-
- $this->assertEquals('pl', $locale);
- }
-
- public function testCreate()
- {
- $request = Request::create('http://test.com/foo?bar=baz');
- $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri());
- $this->assertEquals('/foo', $request->getPathInfo());
- $this->assertEquals('bar=baz', $request->getQueryString());
- $this->assertEquals(80, $request->getPort());
- $this->assertEquals('test.com', $request->getHttpHost());
- $this->assertFalse($request->isSecure());
-
- $request = Request::create('http://test.com/foo', 'GET', array('bar' => 'baz'));
- $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri());
- $this->assertEquals('/foo', $request->getPathInfo());
- $this->assertEquals('bar=baz', $request->getQueryString());
- $this->assertEquals(80, $request->getPort());
- $this->assertEquals('test.com', $request->getHttpHost());
- $this->assertFalse($request->isSecure());
-
- $request = Request::create('http://test.com/foo?bar=foo', 'GET', array('bar' => 'baz'));
- $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri());
- $this->assertEquals('/foo', $request->getPathInfo());
- $this->assertEquals('bar=baz', $request->getQueryString());
- $this->assertEquals(80, $request->getPort());
- $this->assertEquals('test.com', $request->getHttpHost());
- $this->assertFalse($request->isSecure());
-
- $request = Request::create('https://test.com/foo?bar=baz');
- $this->assertEquals('https://test.com/foo?bar=baz', $request->getUri());
- $this->assertEquals('/foo', $request->getPathInfo());
- $this->assertEquals('bar=baz', $request->getQueryString());
- $this->assertEquals(443, $request->getPort());
- $this->assertEquals('test.com', $request->getHttpHost());
- $this->assertTrue($request->isSecure());
-
- $request = Request::create('test.com:90/foo');
- $this->assertEquals('http://test.com:90/foo', $request->getUri());
- $this->assertEquals('/foo', $request->getPathInfo());
- $this->assertEquals('test.com', $request->getHost());
- $this->assertEquals('test.com:90', $request->getHttpHost());
- $this->assertEquals(90, $request->getPort());
- $this->assertFalse($request->isSecure());
-
- $request = Request::create('https://test.com:90/foo');
- $this->assertEquals('https://test.com:90/foo', $request->getUri());
- $this->assertEquals('/foo', $request->getPathInfo());
- $this->assertEquals('test.com', $request->getHost());
- $this->assertEquals('test.com:90', $request->getHttpHost());
- $this->assertEquals(90, $request->getPort());
- $this->assertTrue($request->isSecure());
-
- $request = Request::create('https://127.0.0.1:90/foo');
- $this->assertEquals('https://127.0.0.1:90/foo', $request->getUri());
- $this->assertEquals('/foo', $request->getPathInfo());
- $this->assertEquals('127.0.0.1', $request->getHost());
- $this->assertEquals('127.0.0.1:90', $request->getHttpHost());
- $this->assertEquals(90, $request->getPort());
- $this->assertTrue($request->isSecure());
-
- $request = Request::create('https://[::1]:90/foo');
- $this->assertEquals('https://[::1]:90/foo', $request->getUri());
- $this->assertEquals('/foo', $request->getPathInfo());
- $this->assertEquals('[::1]', $request->getHost());
- $this->assertEquals('[::1]:90', $request->getHttpHost());
- $this->assertEquals(90, $request->getPort());
- $this->assertTrue($request->isSecure());
-
- $request = Request::create('https://[::1]/foo');
- $this->assertEquals('https://[::1]/foo', $request->getUri());
- $this->assertEquals('/foo', $request->getPathInfo());
- $this->assertEquals('[::1]', $request->getHost());
- $this->assertEquals('[::1]', $request->getHttpHost());
- $this->assertEquals(443, $request->getPort());
- $this->assertTrue($request->isSecure());
-
- $json = '{"jsonrpc":"2.0","method":"echo","id":7,"params":["Hello World"]}';
- $request = Request::create('http://example.com/jsonrpc', 'POST', array(), array(), array(), array(), $json);
- $this->assertEquals($json, $request->getContent());
- $this->assertFalse($request->isSecure());
-
- $request = Request::create('http://test.com');
- $this->assertEquals('http://test.com/', $request->getUri());
- $this->assertEquals('/', $request->getPathInfo());
- $this->assertEquals('', $request->getQueryString());
- $this->assertEquals(80, $request->getPort());
- $this->assertEquals('test.com', $request->getHttpHost());
- $this->assertFalse($request->isSecure());
-
- $request = Request::create('http://test.com?test=1');
- $this->assertEquals('http://test.com/?test=1', $request->getUri());
- $this->assertEquals('/', $request->getPathInfo());
- $this->assertEquals('test=1', $request->getQueryString());
- $this->assertEquals(80, $request->getPort());
- $this->assertEquals('test.com', $request->getHttpHost());
- $this->assertFalse($request->isSecure());
-
- $request = Request::create('http://test.com:90/?test=1');
- $this->assertEquals('http://test.com:90/?test=1', $request->getUri());
- $this->assertEquals('/', $request->getPathInfo());
- $this->assertEquals('test=1', $request->getQueryString());
- $this->assertEquals(90, $request->getPort());
- $this->assertEquals('test.com:90', $request->getHttpHost());
- $this->assertFalse($request->isSecure());
-
- $request = Request::create('http://username:password@test.com');
- $this->assertEquals('http://test.com/', $request->getUri());
- $this->assertEquals('/', $request->getPathInfo());
- $this->assertEquals('', $request->getQueryString());
- $this->assertEquals(80, $request->getPort());
- $this->assertEquals('test.com', $request->getHttpHost());
- $this->assertEquals('username', $request->getUser());
- $this->assertEquals('password', $request->getPassword());
- $this->assertFalse($request->isSecure());
-
- $request = Request::create('http://username@test.com');
- $this->assertEquals('http://test.com/', $request->getUri());
- $this->assertEquals('/', $request->getPathInfo());
- $this->assertEquals('', $request->getQueryString());
- $this->assertEquals(80, $request->getPort());
- $this->assertEquals('test.com', $request->getHttpHost());
- $this->assertEquals('username', $request->getUser());
- $this->assertSame('', $request->getPassword());
- $this->assertFalse($request->isSecure());
-
- $request = Request::create('http://test.com/?foo');
- $this->assertEquals('/?foo', $request->getRequestUri());
- $this->assertEquals(array('foo' => ''), $request->query->all());
-
- // assume rewrite rule: (.*) --> app/app.php; app/ is a symlink to a symfony web/ directory
- $request = Request::create('http://test.com/apparthotel-1234', 'GET', array(), array(), array(),
- array(
- 'DOCUMENT_ROOT' => '/var/www/www.test.com',
- 'SCRIPT_FILENAME' => '/var/www/www.test.com/app/app.php',
- 'SCRIPT_NAME' => '/app/app.php',
- 'PHP_SELF' => '/app/app.php/apparthotel-1234',
- ));
- $this->assertEquals('http://test.com/apparthotel-1234', $request->getUri());
- $this->assertEquals('/apparthotel-1234', $request->getPathInfo());
- $this->assertEquals('', $request->getQueryString());
- $this->assertEquals(80, $request->getPort());
- $this->assertEquals('test.com', $request->getHttpHost());
- $this->assertFalse($request->isSecure());
- }
-
- public function testCreateCheckPrecedence()
- {
- // server is used by default
- $request = Request::create('/', 'DELETE', array(), array(), array(), array(
- 'HTTP_HOST' => 'example.com',
- 'HTTPS' => 'on',
- 'SERVER_PORT' => 443,
- 'PHP_AUTH_USER' => 'fabien',
- 'PHP_AUTH_PW' => 'pa$$',
- 'QUERY_STRING' => 'foo=bar',
- 'CONTENT_TYPE' => 'application/json',
- ));
- $this->assertEquals('example.com', $request->getHost());
- $this->assertEquals(443, $request->getPort());
- $this->assertTrue($request->isSecure());
- $this->assertEquals('fabien', $request->getUser());
- $this->assertEquals('pa$$', $request->getPassword());
- $this->assertEquals('', $request->getQueryString());
- $this->assertEquals('application/json', $request->headers->get('CONTENT_TYPE'));
-
- // URI has precedence over server
- $request = Request::create('http://thomas:pokemon@example.net:8080/?foo=bar', 'GET', array(), array(), array(), array(
- 'HTTP_HOST' => 'example.com',
- 'HTTPS' => 'on',
- 'SERVER_PORT' => 443,
- ));
- $this->assertEquals('example.net', $request->getHost());
- $this->assertEquals(8080, $request->getPort());
- $this->assertFalse($request->isSecure());
- $this->assertEquals('thomas', $request->getUser());
- $this->assertEquals('pokemon', $request->getPassword());
- $this->assertEquals('foo=bar', $request->getQueryString());
- }
-
- public function testDuplicate()
- {
- $request = new Request(array('foo' => 'bar'), array('foo' => 'bar'), array('foo' => 'bar'), array(), array(), array('HTTP_FOO' => 'bar'));
- $dup = $request->duplicate();
-
- $this->assertEquals($request->query->all(), $dup->query->all(), '->duplicate() duplicates a request an copy the current query parameters');
- $this->assertEquals($request->request->all(), $dup->request->all(), '->duplicate() duplicates a request an copy the current request parameters');
- $this->assertEquals($request->attributes->all(), $dup->attributes->all(), '->duplicate() duplicates a request an copy the current attributes');
- $this->assertEquals($request->headers->all(), $dup->headers->all(), '->duplicate() duplicates a request an copy the current HTTP headers');
-
- $dup = $request->duplicate(array('foo' => 'foobar'), array('foo' => 'foobar'), array('foo' => 'foobar'), array(), array(), array('HTTP_FOO' => 'foobar'));
-
- $this->assertEquals(array('foo' => 'foobar'), $dup->query->all(), '->duplicate() overrides the query parameters if provided');
- $this->assertEquals(array('foo' => 'foobar'), $dup->request->all(), '->duplicate() overrides the request parameters if provided');
- $this->assertEquals(array('foo' => 'foobar'), $dup->attributes->all(), '->duplicate() overrides the attributes if provided');
- $this->assertEquals(array('foo' => array('foobar')), $dup->headers->all(), '->duplicate() overrides the HTTP header if provided');
- }
-
- public function testDuplicateWithFormat()
- {
- $request = new Request(array(), array(), array('_format' => 'json'));
- $dup = $request->duplicate();
-
- $this->assertEquals('json', $dup->getRequestFormat());
- $this->assertEquals('json', $dup->attributes->get('_format'));
-
- $request = new Request();
- $request->setRequestFormat('xml');
- $dup = $request->duplicate();
-
- $this->assertEquals('xml', $dup->getRequestFormat());
- }
-
- /**
- * @dataProvider getFormatToMimeTypeMapProviderWithAdditionalNullFormat
- */
- public function testGetFormatFromMimeType($format, $mimeTypes)
- {
- $request = new Request();
- foreach ($mimeTypes as $mime) {
- $this->assertEquals($format, $request->getFormat($mime));
- }
- $request->setFormat($format, $mimeTypes);
- foreach ($mimeTypes as $mime) {
- $this->assertEquals($format, $request->getFormat($mime));
-
- if (null !== $format) {
- $this->assertEquals($mimeTypes[0], $request->getMimeType($format));
- }
- }
- }
-
- public function getFormatToMimeTypeMapProviderWithAdditionalNullFormat()
- {
- return array_merge(
- array(array(null, array(null, 'unexistent-mime-type'))),
- $this->getFormatToMimeTypeMapProvider()
- );
- }
-
- public function testGetFormatFromMimeTypeWithParameters()
- {
- $request = new Request();
- $this->assertEquals('json', $request->getFormat('application/json; charset=utf-8'));
- }
-
- /**
- * @dataProvider getFormatToMimeTypeMapProvider
- */
- public function testGetMimeTypeFromFormat($format, $mimeTypes)
- {
- $request = new Request();
- $this->assertEquals($mimeTypes[0], $request->getMimeType($format));
- }
-
- /**
- * @dataProvider getFormatToMimeTypeMapProvider
- */
- public function testGetMimeTypesFromFormat($format, $mimeTypes)
- {
- $this->assertEquals($mimeTypes, Request::getMimeTypes($format));
- }
-
- public function testGetMimeTypesFromInexistentFormat()
- {
- $request = new Request();
- $this->assertNull($request->getMimeType('foo'));
- $this->assertEquals(array(), Request::getMimeTypes('foo'));
- }
-
- public function testGetFormatWithCustomMimeType()
- {
- $request = new Request();
- $request->setFormat('custom', 'application/vnd.foo.api;myversion=2.3');
- $this->assertEquals('custom', $request->getFormat('application/vnd.foo.api;myversion=2.3'));
- }
-
- public function getFormatToMimeTypeMapProvider()
- {
- return array(
- array('txt', array('text/plain')),
- array('js', array('application/javascript', 'application/x-javascript', 'text/javascript')),
- array('css', array('text/css')),
- array('json', array('application/json', 'application/x-json')),
- array('jsonld', array('application/ld+json')),
- array('xml', array('text/xml', 'application/xml', 'application/x-xml')),
- array('rdf', array('application/rdf+xml')),
- array('atom', array('application/atom+xml')),
- );
- }
-
- public function testGetUri()
- {
- $server = array();
-
- // Standard Request on non default PORT
- // http://host:8080/index.php/path/info?query=string
-
- $server['HTTP_HOST'] = 'host:8080';
- $server['SERVER_NAME'] = 'servername';
- $server['SERVER_PORT'] = '8080';
-
- $server['QUERY_STRING'] = 'query=string';
- $server['REQUEST_URI'] = '/index.php/path/info?query=string';
- $server['SCRIPT_NAME'] = '/index.php';
- $server['PATH_INFO'] = '/path/info';
- $server['PATH_TRANSLATED'] = 'redirect:/index.php/path/info';
- $server['PHP_SELF'] = '/index_dev.php/path/info';
- $server['SCRIPT_FILENAME'] = '/some/where/index.php';
-
- $request = new Request();
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('http://host:8080/index.php/path/info?query=string', $request->getUri(), '->getUri() with non default port');
-
- // Use std port number
- $server['HTTP_HOST'] = 'host';
- $server['SERVER_NAME'] = 'servername';
- $server['SERVER_PORT'] = '80';
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('http://host/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port');
-
- // Without HOST HEADER
- unset($server['HTTP_HOST']);
- $server['SERVER_NAME'] = 'servername';
- $server['SERVER_PORT'] = '80';
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('http://servername/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port without HOST_HEADER');
-
- // Request with URL REWRITING (hide index.php)
- // RewriteCond %{REQUEST_FILENAME} !-f
- // RewriteRule ^(.*)$ index.php [QSA,L]
- // http://host:8080/path/info?query=string
- $server = array();
- $server['HTTP_HOST'] = 'host:8080';
- $server['SERVER_NAME'] = 'servername';
- $server['SERVER_PORT'] = '8080';
-
- $server['REDIRECT_QUERY_STRING'] = 'query=string';
- $server['REDIRECT_URL'] = '/path/info';
- $server['SCRIPT_NAME'] = '/index.php';
- $server['QUERY_STRING'] = 'query=string';
- $server['REQUEST_URI'] = '/path/info?toto=test&1=1';
- $server['SCRIPT_NAME'] = '/index.php';
- $server['PHP_SELF'] = '/index.php';
- $server['SCRIPT_FILENAME'] = '/some/where/index.php';
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('http://host:8080/path/info?query=string', $request->getUri(), '->getUri() with rewrite');
-
- // Use std port number
- // http://host/path/info?query=string
- $server['HTTP_HOST'] = 'host';
- $server['SERVER_NAME'] = 'servername';
- $server['SERVER_PORT'] = '80';
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('http://host/path/info?query=string', $request->getUri(), '->getUri() with rewrite and default port');
-
- // Without HOST HEADER
- unset($server['HTTP_HOST']);
- $server['SERVER_NAME'] = 'servername';
- $server['SERVER_PORT'] = '80';
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('http://servername/path/info?query=string', $request->getUri(), '->getUri() with rewrite, default port without HOST_HEADER');
-
- // With encoded characters
-
- $server = array(
- 'HTTP_HOST' => 'host:8080',
- 'SERVER_NAME' => 'servername',
- 'SERVER_PORT' => '8080',
- 'QUERY_STRING' => 'query=string',
- 'REQUEST_URI' => '/ba%20se/index_dev.php/foo%20bar/in+fo?query=string',
- 'SCRIPT_NAME' => '/ba se/index_dev.php',
- 'PATH_TRANSLATED' => 'redirect:/index.php/foo bar/in+fo',
- 'PHP_SELF' => '/ba se/index_dev.php/path/info',
- 'SCRIPT_FILENAME' => '/some/where/ba se/index_dev.php',
- );
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals(
- 'http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string',
- $request->getUri()
- );
-
- // with user info
-
- $server['PHP_AUTH_USER'] = 'fabien';
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri());
-
- $server['PHP_AUTH_PW'] = 'symfony';
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri());
- }
-
- public function testGetUriForPath()
- {
- $request = Request::create('http://test.com/foo?bar=baz');
- $this->assertEquals('http://test.com/some/path', $request->getUriForPath('/some/path'));
-
- $request = Request::create('http://test.com:90/foo?bar=baz');
- $this->assertEquals('http://test.com:90/some/path', $request->getUriForPath('/some/path'));
-
- $request = Request::create('https://test.com/foo?bar=baz');
- $this->assertEquals('https://test.com/some/path', $request->getUriForPath('/some/path'));
-
- $request = Request::create('https://test.com:90/foo?bar=baz');
- $this->assertEquals('https://test.com:90/some/path', $request->getUriForPath('/some/path'));
-
- $server = array();
-
- // Standard Request on non default PORT
- // http://host:8080/index.php/path/info?query=string
-
- $server['HTTP_HOST'] = 'host:8080';
- $server['SERVER_NAME'] = 'servername';
- $server['SERVER_PORT'] = '8080';
-
- $server['QUERY_STRING'] = 'query=string';
- $server['REQUEST_URI'] = '/index.php/path/info?query=string';
- $server['SCRIPT_NAME'] = '/index.php';
- $server['PATH_INFO'] = '/path/info';
- $server['PATH_TRANSLATED'] = 'redirect:/index.php/path/info';
- $server['PHP_SELF'] = '/index_dev.php/path/info';
- $server['SCRIPT_FILENAME'] = '/some/where/index.php';
-
- $request = new Request();
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('http://host:8080/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with non default port');
-
- // Use std port number
- $server['HTTP_HOST'] = 'host';
- $server['SERVER_NAME'] = 'servername';
- $server['SERVER_PORT'] = '80';
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('http://host/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port');
-
- // Without HOST HEADER
- unset($server['HTTP_HOST']);
- $server['SERVER_NAME'] = 'servername';
- $server['SERVER_PORT'] = '80';
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('http://servername/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port without HOST_HEADER');
-
- // Request with URL REWRITING (hide index.php)
- // RewriteCond %{REQUEST_FILENAME} !-f
- // RewriteRule ^(.*)$ index.php [QSA,L]
- // http://host:8080/path/info?query=string
- $server = array();
- $server['HTTP_HOST'] = 'host:8080';
- $server['SERVER_NAME'] = 'servername';
- $server['SERVER_PORT'] = '8080';
-
- $server['REDIRECT_QUERY_STRING'] = 'query=string';
- $server['REDIRECT_URL'] = '/path/info';
- $server['SCRIPT_NAME'] = '/index.php';
- $server['QUERY_STRING'] = 'query=string';
- $server['REQUEST_URI'] = '/path/info?toto=test&1=1';
- $server['SCRIPT_NAME'] = '/index.php';
- $server['PHP_SELF'] = '/index.php';
- $server['SCRIPT_FILENAME'] = '/some/where/index.php';
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('http://host:8080/some/path', $request->getUriForPath('/some/path'), '->getUri() with rewrite');
-
- // Use std port number
- // http://host/path/info?query=string
- $server['HTTP_HOST'] = 'host';
- $server['SERVER_NAME'] = 'servername';
- $server['SERVER_PORT'] = '80';
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('http://host/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite and default port');
-
- // Without HOST HEADER
- unset($server['HTTP_HOST']);
- $server['SERVER_NAME'] = 'servername';
- $server['SERVER_PORT'] = '80';
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite, default port without HOST_HEADER');
- $this->assertEquals('servername', $request->getHttpHost());
-
- // with user info
-
- $server['PHP_AUTH_USER'] = 'fabien';
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path'));
-
- $server['PHP_AUTH_PW'] = 'symfony';
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path'));
- }
-
- /**
- * @dataProvider getRelativeUriForPathData()
- */
- public function testGetRelativeUriForPath($expected, $pathinfo, $path)
- {
- $this->assertEquals($expected, Request::create($pathinfo)->getRelativeUriForPath($path));
- }
-
- public function getRelativeUriForPathData()
- {
- return array(
- array('me.png', '/foo', '/me.png'),
- array('../me.png', '/foo/bar', '/me.png'),
- array('me.png', '/foo/bar', '/foo/me.png'),
- array('../baz/me.png', '/foo/bar/b', '/foo/baz/me.png'),
- array('../../fooz/baz/me.png', '/foo/bar/b', '/fooz/baz/me.png'),
- array('baz/me.png', '/foo/bar/b', 'baz/me.png'),
- );
- }
-
- public function testGetUserInfo()
- {
- $request = new Request();
-
- $server = array('PHP_AUTH_USER' => 'fabien');
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('fabien', $request->getUserInfo());
-
- $server['PHP_AUTH_USER'] = '0';
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('0', $request->getUserInfo());
-
- $server['PHP_AUTH_PW'] = '0';
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('0:0', $request->getUserInfo());
- }
-
- public function testGetSchemeAndHttpHost()
- {
- $request = new Request();
-
- $server = array();
- $server['SERVER_NAME'] = 'servername';
- $server['SERVER_PORT'] = '90';
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost());
-
- $server['PHP_AUTH_USER'] = 'fabien';
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost());
-
- $server['PHP_AUTH_USER'] = '0';
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost());
-
- $server['PHP_AUTH_PW'] = '0';
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost());
- }
-
- /**
- * @dataProvider getQueryStringNormalizationData
- */
- public function testGetQueryString($query, $expectedQuery, $msg)
- {
- $request = new Request();
-
- $request->server->set('QUERY_STRING', $query);
- $this->assertSame($expectedQuery, $request->getQueryString(), $msg);
- }
-
- public function getQueryStringNormalizationData()
- {
- return array(
- array('foo', 'foo', 'works with valueless parameters'),
- array('foo=', 'foo=', 'includes a dangling equal sign'),
- array('bar=&foo=bar', 'bar=&foo=bar', '->works with empty parameters'),
- array('foo=bar&bar=', 'bar=&foo=bar', 'sorts keys alphabetically'),
-
- // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded).
- // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str.
- array('him=John%20Doe&her=Jane+Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes spaces in both encodings "%20" and "+"'),
-
- array('foo[]=1&foo[]=2', 'foo%5B%5D=1&foo%5B%5D=2', 'allows array notation'),
- array('foo=1&foo=2', 'foo=1&foo=2', 'allows repeated parameters'),
- array('pa%3Dram=foo%26bar%3Dbaz&test=test', 'pa%3Dram=foo%26bar%3Dbaz&test=test', 'works with encoded delimiters'),
- array('0', '0', 'allows "0"'),
- array('Jane Doe&John%20Doe', 'Jane%20Doe&John%20Doe', 'normalizes encoding in keys'),
- array('her=Jane Doe&him=John%20Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes encoding in values'),
- array('foo=bar&&&test&&', 'foo=bar&test', 'removes unneeded delimiters'),
- array('formula=e=m*c^2', 'formula=e%3Dm%2Ac%5E2', 'correctly treats only the first "=" as delimiter and the next as value'),
-
- // Ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway.
- // PHP also does not include them when building _GET.
- array('foo=bar&=a=b&=x=y', 'foo=bar', 'removes params with empty key'),
- );
- }
-
- public function testGetQueryStringReturnsNull()
- {
- $request = new Request();
-
- $this->assertNull($request->getQueryString(), '->getQueryString() returns null for non-existent query string');
-
- $request->server->set('QUERY_STRING', '');
- $this->assertNull($request->getQueryString(), '->getQueryString() returns null for empty query string');
- }
-
- public function testGetHost()
- {
- $request = new Request();
-
- $request->initialize(array('foo' => 'bar'));
- $this->assertEquals('', $request->getHost(), '->getHost() return empty string if not initialized');
-
- $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.example.com'));
- $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from Host Header');
-
- // Host header with port number
- $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.example.com:8080'));
- $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from Host Header with port number');
-
- // Server values
- $request->initialize(array(), array(), array(), array(), array(), array('SERVER_NAME' => 'www.example.com'));
- $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from server name');
-
- $request->initialize(array(), array(), array(), array(), array(), array('SERVER_NAME' => 'www.example.com', 'HTTP_HOST' => 'www.host.com'));
- $this->assertEquals('www.host.com', $request->getHost(), '->getHost() value from Host header has priority over SERVER_NAME ');
- }
-
- public function testGetPort()
- {
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
- 'HTTP_X_FORWARDED_PROTO' => 'https',
- 'HTTP_X_FORWARDED_PORT' => '443',
- ));
- $port = $request->getPort();
-
- $this->assertEquals(80, $port, 'Without trusted proxies FORWARDED_PROTO and FORWARDED_PORT are ignored.');
-
- Request::setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_ALL);
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
- 'HTTP_X_FORWARDED_PROTO' => 'https',
- 'HTTP_X_FORWARDED_PORT' => '8443',
- ));
- $this->assertEquals(80, $request->getPort(), 'With PROTO and PORT on untrusted connection server value takes precedence.');
- $request->server->set('REMOTE_ADDR', '1.1.1.1');
- $this->assertEquals(8443, $request->getPort(), 'With PROTO and PORT set PORT takes precedence.');
-
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
- 'HTTP_X_FORWARDED_PROTO' => 'https',
- ));
- $this->assertEquals(80, $request->getPort(), 'With only PROTO set getPort() ignores trusted headers on untrusted connection.');
- $request->server->set('REMOTE_ADDR', '1.1.1.1');
- $this->assertEquals(443, $request->getPort(), 'With only PROTO set getPort() defaults to 443.');
-
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
- 'HTTP_X_FORWARDED_PROTO' => 'http',
- ));
- $this->assertEquals(80, $request->getPort(), 'If X_FORWARDED_PROTO is set to HTTP getPort() ignores trusted headers on untrusted connection.');
- $request->server->set('REMOTE_ADDR', '1.1.1.1');
- $this->assertEquals(80, $request->getPort(), 'If X_FORWARDED_PROTO is set to HTTP getPort() returns port of the original request.');
-
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
- 'HTTP_X_FORWARDED_PROTO' => 'On',
- ));
- $this->assertEquals(80, $request->getPort(), 'With only PROTO set and value is On, getPort() ignores trusted headers on untrusted connection.');
- $request->server->set('REMOTE_ADDR', '1.1.1.1');
- $this->assertEquals(443, $request->getPort(), 'With only PROTO set and value is On, getPort() defaults to 443.');
-
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
- 'HTTP_X_FORWARDED_PROTO' => '1',
- ));
- $this->assertEquals(80, $request->getPort(), 'With only PROTO set and value is 1, getPort() ignores trusted headers on untrusted connection.');
- $request->server->set('REMOTE_ADDR', '1.1.1.1');
- $this->assertEquals(443, $request->getPort(), 'With only PROTO set and value is 1, getPort() defaults to 443.');
-
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
- 'HTTP_X_FORWARDED_PROTO' => 'something-else',
- ));
- $port = $request->getPort();
- $this->assertEquals(80, $port, 'With only PROTO set and value is not recognized, getPort() defaults to 80.');
- }
-
- /**
- * @expectedException \RuntimeException
- */
- public function testGetHostWithFakeHttpHostValue()
- {
- $request = new Request();
- $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.host.com?query=string'));
- $request->getHost();
- }
-
- public function testGetSetMethod()
- {
- $request = new Request();
-
- $this->assertEquals('GET', $request->getMethod(), '->getMethod() returns GET if no method is defined');
-
- $request->setMethod('get');
- $this->assertEquals('GET', $request->getMethod(), '->getMethod() returns an uppercased string');
-
- $request->setMethod('PURGE');
- $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method even if it is not a standard one');
-
- $request->setMethod('POST');
- $this->assertEquals('POST', $request->getMethod(), '->getMethod() returns the method POST if no _method is defined');
-
- $request->setMethod('POST');
- $request->request->set('_method', 'purge');
- $this->assertEquals('POST', $request->getMethod(), '->getMethod() does not return the method from _method if defined and POST but support not enabled');
-
- $request = new Request();
- $request->setMethod('POST');
- $request->request->set('_method', 'purge');
-
- $this->assertFalse(Request::getHttpMethodParameterOverride(), 'httpMethodParameterOverride should be disabled by default');
-
- Request::enableHttpMethodParameterOverride();
-
- $this->assertTrue(Request::getHttpMethodParameterOverride(), 'httpMethodParameterOverride should be enabled now but it is not');
-
- $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method from _method if defined and POST');
- $this->disableHttpMethodParameterOverride();
-
- $request = new Request();
- $request->setMethod('POST');
- $request->query->set('_method', 'purge');
- $this->assertEquals('POST', $request->getMethod(), '->getMethod() does not return the method from _method if defined and POST but support not enabled');
-
- $request = new Request();
- $request->setMethod('POST');
- $request->query->set('_method', 'purge');
- Request::enableHttpMethodParameterOverride();
- $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method from _method if defined and POST');
- $this->disableHttpMethodParameterOverride();
-
- $request = new Request();
- $request->setMethod('POST');
- $request->headers->set('X-HTTP-METHOD-OVERRIDE', 'delete');
- $this->assertEquals('DELETE', $request->getMethod(), '->getMethod() returns the method from X-HTTP-Method-Override even though _method is set if defined and POST');
-
- $request = new Request();
- $request->setMethod('POST');
- $request->headers->set('X-HTTP-METHOD-OVERRIDE', 'delete');
- $this->assertEquals('DELETE', $request->getMethod(), '->getMethod() returns the method from X-HTTP-Method-Override if defined and POST');
- }
-
- /**
- * @dataProvider getClientIpsProvider
- */
- public function testGetClientIp($expected, $remoteAddr, $httpForwardedFor, $trustedProxies)
- {
- $request = $this->getRequestInstanceForClientIpTests($remoteAddr, $httpForwardedFor, $trustedProxies);
-
- $this->assertEquals($expected[0], $request->getClientIp());
- }
-
- /**
- * @dataProvider getClientIpsProvider
- */
- public function testGetClientIps($expected, $remoteAddr, $httpForwardedFor, $trustedProxies)
- {
- $request = $this->getRequestInstanceForClientIpTests($remoteAddr, $httpForwardedFor, $trustedProxies);
-
- $this->assertEquals($expected, $request->getClientIps());
- }
-
- /**
- * @dataProvider getClientIpsForwardedProvider
- */
- public function testGetClientIpsForwarded($expected, $remoteAddr, $httpForwarded, $trustedProxies)
- {
- $request = $this->getRequestInstanceForClientIpsForwardedTests($remoteAddr, $httpForwarded, $trustedProxies);
-
- $this->assertEquals($expected, $request->getClientIps());
- }
-
- public function getClientIpsForwardedProvider()
- {
- // $expected $remoteAddr $httpForwarded $trustedProxies
- return array(
- array(array('127.0.0.1'), '127.0.0.1', 'for="_gazonk"', null),
- array(array('127.0.0.1'), '127.0.0.1', 'for="_gazonk"', array('127.0.0.1')),
- array(array('88.88.88.88'), '127.0.0.1', 'for="88.88.88.88:80"', array('127.0.0.1')),
- array(array('192.0.2.60'), '::1', 'for=192.0.2.60;proto=http;by=203.0.113.43', array('::1')),
- array(array('2620:0:1cfe:face:b00c::3', '192.0.2.43'), '::1', 'for=192.0.2.43, for=2620:0:1cfe:face:b00c::3', array('::1')),
- array(array('2001:db8:cafe::17'), '::1', 'for="[2001:db8:cafe::17]:4711', array('::1')),
- );
- }
-
- public function getClientIpsProvider()
- {
- // $expected $remoteAddr $httpForwardedFor $trustedProxies
- return array(
- // simple IPv4
- array(array('88.88.88.88'), '88.88.88.88', null, null),
- // trust the IPv4 remote addr
- array(array('88.88.88.88'), '88.88.88.88', null, array('88.88.88.88')),
-
- // simple IPv6
- array(array('::1'), '::1', null, null),
- // trust the IPv6 remote addr
- array(array('::1'), '::1', null, array('::1')),
-
- // forwarded for with remote IPv4 addr not trusted
- array(array('127.0.0.1'), '127.0.0.1', '88.88.88.88', null),
- // forwarded for with remote IPv4 addr trusted
- array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88', array('127.0.0.1')),
- // forwarded for with remote IPv4 and all FF addrs trusted
- array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88', array('127.0.0.1', '88.88.88.88')),
- // forwarded for with remote IPv4 range trusted
- array(array('88.88.88.88'), '123.45.67.89', '88.88.88.88', array('123.45.67.0/24')),
-
- // forwarded for with remote IPv6 addr not trusted
- array(array('1620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', null),
- // forwarded for with remote IPv6 addr trusted
- array(array('2620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3')),
- // forwarded for with remote IPv6 range trusted
- array(array('88.88.88.88'), '2a01:198:603:0:396e:4789:8e99:890f', '88.88.88.88', array('2a01:198:603:0::/65')),
-
- // multiple forwarded for with remote IPv4 addr trusted
- array(array('88.88.88.88', '87.65.43.21', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89')),
- // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted
- array(array('87.65.43.21', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '88.88.88.88')),
- // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted but in the middle
- array(array('88.88.88.88', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '87.65.43.21')),
- // multiple forwarded for with remote IPv4 addr and all reverse proxies trusted
- array(array('127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '87.65.43.21', '88.88.88.88', '127.0.0.1')),
-
- // multiple forwarded for with remote IPv6 addr trusted
- array(array('2620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3')),
- // multiple forwarded for with remote IPv6 addr and some reverse proxies trusted
- array(array('3620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3')),
- // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted but in the middle
- array(array('2620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3,3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3')),
-
- // client IP with port
- array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88:12345, 127.0.0.1', array('127.0.0.1')),
-
- // invalid forwarded IP is ignored
- array(array('88.88.88.88'), '127.0.0.1', 'unknown,88.88.88.88', array('127.0.0.1')),
- array(array('88.88.88.88'), '127.0.0.1', '}__test|O:21:&quot;JDatabaseDriverMysqli&quot;:3:{s:2,88.88.88.88', array('127.0.0.1')),
- );
- }
-
- /**
- * @expectedException \Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException
- * @dataProvider getClientIpsWithConflictingHeadersProvider
- */
- public function testGetClientIpsWithConflictingHeaders($httpForwarded, $httpXForwardedFor)
- {
- $request = new Request();
-
- $server = array(
- 'REMOTE_ADDR' => '88.88.88.88',
- 'HTTP_FORWARDED' => $httpForwarded,
- 'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor,
- );
-
- Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_ALL | Request::HEADER_FORWARDED);
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $request->getClientIps();
- }
-
- /**
- * @dataProvider getClientIpsWithConflictingHeadersProvider
- */
- public function testGetClientIpsOnlyXHttpForwardedForTrusted($httpForwarded, $httpXForwardedFor)
- {
- $request = new Request();
-
- $server = array(
- 'REMOTE_ADDR' => '88.88.88.88',
- 'HTTP_FORWARDED' => $httpForwarded,
- 'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor,
- );
-
- Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_FOR);
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertSame(array_reverse(explode(',', $httpXForwardedFor)), $request->getClientIps());
- }
-
- public function getClientIpsWithConflictingHeadersProvider()
- {
- // $httpForwarded $httpXForwardedFor
- return array(
- array('for=87.65.43.21', '192.0.2.60'),
- array('for=87.65.43.21, for=192.0.2.60', '192.0.2.60'),
- array('for=192.0.2.60', '192.0.2.60,87.65.43.21'),
- array('for="::face", for=192.0.2.60', '192.0.2.60,192.0.2.43'),
- array('for=87.65.43.21, for=192.0.2.60', '192.0.2.60,87.65.43.21'),
- );
- }
-
- /**
- * @dataProvider getClientIpsWithAgreeingHeadersProvider
- */
- public function testGetClientIpsWithAgreeingHeaders($httpForwarded, $httpXForwardedFor, $expectedIps)
- {
- $request = new Request();
-
- $server = array(
- 'REMOTE_ADDR' => '88.88.88.88',
- 'HTTP_FORWARDED' => $httpForwarded,
- 'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor,
- );
-
- Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_ALL);
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $clientIps = $request->getClientIps();
-
- $this->assertSame($expectedIps, $clientIps);
- }
-
- public function getClientIpsWithAgreeingHeadersProvider()
- {
- // $httpForwarded $httpXForwardedFor
- return array(
- array('for="192.0.2.60"', '192.0.2.60', array('192.0.2.60')),
- array('for=192.0.2.60, for=87.65.43.21', '192.0.2.60,87.65.43.21', array('87.65.43.21', '192.0.2.60')),
- array('for="[::face]", for=192.0.2.60', '::face,192.0.2.60', array('192.0.2.60', '::face')),
- array('for="192.0.2.60:80"', '192.0.2.60', array('192.0.2.60')),
- array('for=192.0.2.60;proto=http;by=203.0.113.43', '192.0.2.60', array('192.0.2.60')),
- array('for="[2001:db8:cafe::17]:4711"', '2001:db8:cafe::17', array('2001:db8:cafe::17')),
- );
- }
-
- public function testGetContentWorksTwiceInDefaultMode()
- {
- $req = new Request();
- $this->assertEquals('', $req->getContent());
- $this->assertEquals('', $req->getContent());
- }
-
- public function testGetContentReturnsResource()
- {
- $req = new Request();
- $retval = $req->getContent(true);
- $this->assertInternalType('resource', $retval);
- $this->assertEquals('', fread($retval, 1));
- $this->assertTrue(feof($retval));
- }
-
- public function testGetContentReturnsResourceWhenContentSetInConstructor()
- {
- $req = new Request(array(), array(), array(), array(), array(), array(), 'MyContent');
- $resource = $req->getContent(true);
-
- $this->assertInternalType('resource', $resource);
- $this->assertEquals('MyContent', stream_get_contents($resource));
- }
-
- public function testContentAsResource()
- {
- $resource = fopen('php://memory', 'r+');
- fwrite($resource, 'My other content');
- rewind($resource);
-
- $req = new Request(array(), array(), array(), array(), array(), array(), $resource);
- $this->assertEquals('My other content', stream_get_contents($req->getContent(true)));
- $this->assertEquals('My other content', $req->getContent());
- }
-
- /**
- * @expectedException \LogicException
- * @dataProvider getContentCantBeCalledTwiceWithResourcesProvider
- */
- public function testGetContentCantBeCalledTwiceWithResources($first, $second)
- {
- if (\PHP_VERSION_ID >= 50600) {
- $this->markTestSkipped('PHP >= 5.6 allows to open php://input several times.');
- }
-
- $req = new Request();
- $req->getContent($first);
- $req->getContent($second);
- }
-
- public function getContentCantBeCalledTwiceWithResourcesProvider()
- {
- return array(
- 'Resource then fetch' => array(true, false),
- 'Resource then resource' => array(true, true),
- );
- }
-
- /**
- * @dataProvider getContentCanBeCalledTwiceWithResourcesProvider
- * @requires PHP 5.6
- */
- public function testGetContentCanBeCalledTwiceWithResources($first, $second)
- {
- $req = new Request();
- $a = $req->getContent($first);
- $b = $req->getContent($second);
-
- if ($first) {
- $a = stream_get_contents($a);
- }
-
- if ($second) {
- $b = stream_get_contents($b);
- }
-
- $this->assertSame($a, $b);
- }
-
- public function getContentCanBeCalledTwiceWithResourcesProvider()
- {
- return array(
- 'Fetch then fetch' => array(false, false),
- 'Fetch then resource' => array(false, true),
- 'Resource then fetch' => array(true, false),
- 'Resource then resource' => array(true, true),
- );
- }
-
- public function provideOverloadedMethods()
- {
- return array(
- array('PUT'),
- array('DELETE'),
- array('PATCH'),
- array('put'),
- array('delete'),
- array('patch'),
- );
- }
-
- /**
- * @dataProvider provideOverloadedMethods
- */
- public function testCreateFromGlobals($method)
- {
- $normalizedMethod = strtoupper($method);
-
- $_GET['foo1'] = 'bar1';
- $_POST['foo2'] = 'bar2';
- $_COOKIE['foo3'] = 'bar3';
- $_FILES['foo4'] = array('bar4');
- $_SERVER['foo5'] = 'bar5';
-
- $request = Request::createFromGlobals();
- $this->assertEquals('bar1', $request->query->get('foo1'), '::fromGlobals() uses values from $_GET');
- $this->assertEquals('bar2', $request->request->get('foo2'), '::fromGlobals() uses values from $_POST');
- $this->assertEquals('bar3', $request->cookies->get('foo3'), '::fromGlobals() uses values from $_COOKIE');
- $this->assertEquals(array('bar4'), $request->files->get('foo4'), '::fromGlobals() uses values from $_FILES');
- $this->assertEquals('bar5', $request->server->get('foo5'), '::fromGlobals() uses values from $_SERVER');
-
- unset($_GET['foo1'], $_POST['foo2'], $_COOKIE['foo3'], $_FILES['foo4'], $_SERVER['foo5']);
-
- $_SERVER['REQUEST_METHOD'] = $method;
- $_SERVER['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
- $request = RequestContentProxy::createFromGlobals();
- $this->assertEquals($normalizedMethod, $request->getMethod());
- $this->assertEquals('mycontent', $request->request->get('content'));
-
- unset($_SERVER['REQUEST_METHOD'], $_SERVER['CONTENT_TYPE']);
-
- Request::createFromGlobals();
- Request::enableHttpMethodParameterOverride();
- $_POST['_method'] = $method;
- $_POST['foo6'] = 'bar6';
- $_SERVER['REQUEST_METHOD'] = 'PoSt';
- $request = Request::createFromGlobals();
- $this->assertEquals($normalizedMethod, $request->getMethod());
- $this->assertEquals('POST', $request->getRealMethod());
- $this->assertEquals('bar6', $request->request->get('foo6'));
-
- unset($_POST['_method'], $_POST['foo6'], $_SERVER['REQUEST_METHOD']);
- $this->disableHttpMethodParameterOverride();
- }
-
- public function testOverrideGlobals()
- {
- $request = new Request();
- $request->initialize(array('foo' => 'bar'));
-
- // as the Request::overrideGlobals really work, it erase $_SERVER, so we must backup it
- $server = $_SERVER;
-
- $request->overrideGlobals();
-
- $this->assertEquals(array('foo' => 'bar'), $_GET);
-
- $request->initialize(array(), array('foo' => 'bar'));
- $request->overrideGlobals();
-
- $this->assertEquals(array('foo' => 'bar'), $_POST);
-
- $this->assertArrayNotHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER);
-
- $request->headers->set('X_FORWARDED_PROTO', 'https');
-
- Request::setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_ALL);
- $this->assertFalse($request->isSecure());
- $request->server->set('REMOTE_ADDR', '1.1.1.1');
- $this->assertTrue($request->isSecure());
-
- $request->overrideGlobals();
-
- $this->assertArrayHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER);
-
- $request->headers->set('CONTENT_TYPE', 'multipart/form-data');
- $request->headers->set('CONTENT_LENGTH', 12345);
-
- $request->overrideGlobals();
-
- $this->assertArrayHasKey('CONTENT_TYPE', $_SERVER);
- $this->assertArrayHasKey('CONTENT_LENGTH', $_SERVER);
-
- $request->initialize(array('foo' => 'bar', 'baz' => 'foo'));
- $request->query->remove('baz');
-
- $request->overrideGlobals();
-
- $this->assertEquals(array('foo' => 'bar'), $_GET);
- $this->assertEquals('foo=bar', $_SERVER['QUERY_STRING']);
- $this->assertEquals('foo=bar', $request->server->get('QUERY_STRING'));
-
- // restore initial $_SERVER array
- $_SERVER = $server;
- }
-
- public function testGetScriptName()
- {
- $request = new Request();
- $this->assertEquals('', $request->getScriptName());
-
- $server = array();
- $server['SCRIPT_NAME'] = '/index.php';
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('/index.php', $request->getScriptName());
-
- $server = array();
- $server['ORIG_SCRIPT_NAME'] = '/frontend.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('/frontend.php', $request->getScriptName());
-
- $server = array();
- $server['SCRIPT_NAME'] = '/index.php';
- $server['ORIG_SCRIPT_NAME'] = '/frontend.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('/index.php', $request->getScriptName());
- }
-
- public function testGetBasePath()
- {
- $request = new Request();
- $this->assertEquals('', $request->getBasePath());
-
- $server = array();
- $server['SCRIPT_FILENAME'] = '/some/where/index.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
- $this->assertEquals('', $request->getBasePath());
-
- $server = array();
- $server['SCRIPT_FILENAME'] = '/some/where/index.php';
- $server['SCRIPT_NAME'] = '/index.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('', $request->getBasePath());
-
- $server = array();
- $server['SCRIPT_FILENAME'] = '/some/where/index.php';
- $server['PHP_SELF'] = '/index.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('', $request->getBasePath());
-
- $server = array();
- $server['SCRIPT_FILENAME'] = '/some/where/index.php';
- $server['ORIG_SCRIPT_NAME'] = '/index.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('', $request->getBasePath());
- }
-
- public function testGetPathInfo()
- {
- $request = new Request();
- $this->assertEquals('/', $request->getPathInfo());
-
- $server = array();
- $server['REQUEST_URI'] = '/path/info';
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('/path/info', $request->getPathInfo());
-
- $server = array();
- $server['REQUEST_URI'] = '/path%20test/info';
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('/path%20test/info', $request->getPathInfo());
-
- $server = array();
- $server['REQUEST_URI'] = '?a=b';
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals('/', $request->getPathInfo());
- }
-
- public function testGetParameterPrecedence()
- {
- $request = new Request();
- $request->attributes->set('foo', 'attr');
- $request->query->set('foo', 'query');
- $request->request->set('foo', 'body');
-
- $this->assertSame('attr', $request->get('foo'));
-
- $request->attributes->remove('foo');
- $this->assertSame('query', $request->get('foo'));
-
- $request->query->remove('foo');
- $this->assertSame('body', $request->get('foo'));
-
- $request->request->remove('foo');
- $this->assertNull($request->get('foo'));
- }
-
- public function testGetPreferredLanguage()
- {
- $request = new Request();
- $this->assertNull($request->getPreferredLanguage());
- $this->assertNull($request->getPreferredLanguage(array()));
- $this->assertEquals('fr', $request->getPreferredLanguage(array('fr')));
- $this->assertEquals('fr', $request->getPreferredLanguage(array('fr', 'en')));
- $this->assertEquals('en', $request->getPreferredLanguage(array('en', 'fr')));
- $this->assertEquals('fr-ch', $request->getPreferredLanguage(array('fr-ch', 'fr-fr')));
-
- $request = new Request();
- $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6');
- $this->assertEquals('en', $request->getPreferredLanguage(array('en', 'en-us')));
-
- $request = new Request();
- $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6');
- $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en')));
-
- $request = new Request();
- $request->headers->set('Accept-language', 'zh, en-us; q=0.8');
- $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en')));
-
- $request = new Request();
- $request->headers->set('Accept-language', 'zh, en-us; q=0.8, fr-fr; q=0.6, fr; q=0.5');
- $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en')));
- }
-
- public function testIsXmlHttpRequest()
- {
- $request = new Request();
- $this->assertFalse($request->isXmlHttpRequest());
-
- $request->headers->set('X-Requested-With', 'XMLHttpRequest');
- $this->assertTrue($request->isXmlHttpRequest());
-
- $request->headers->remove('X-Requested-With');
- $this->assertFalse($request->isXmlHttpRequest());
- }
-
- /**
- * @requires extension intl
- */
- public function testIntlLocale()
- {
- $request = new Request();
-
- $request->setDefaultLocale('fr');
- $this->assertEquals('fr', $request->getLocale());
- $this->assertEquals('fr', \Locale::getDefault());
-
- $request->setLocale('en');
- $this->assertEquals('en', $request->getLocale());
- $this->assertEquals('en', \Locale::getDefault());
-
- $request->setDefaultLocale('de');
- $this->assertEquals('en', $request->getLocale());
- $this->assertEquals('en', \Locale::getDefault());
- }
-
- public function testGetCharsets()
- {
- $request = new Request();
- $this->assertEquals(array(), $request->getCharsets());
- $request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6');
- $this->assertEquals(array(), $request->getCharsets()); // testing caching
-
- $request = new Request();
- $request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6');
- $this->assertEquals(array('ISO-8859-1', 'US-ASCII', 'UTF-8', 'ISO-10646-UCS-2'), $request->getCharsets());
-
- $request = new Request();
- $request->headers->set('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7');
- $this->assertEquals(array('ISO-8859-1', 'utf-8', '*'), $request->getCharsets());
- }
-
- public function testGetEncodings()
- {
- $request = new Request();
- $this->assertEquals(array(), $request->getEncodings());
- $request->headers->set('Accept-Encoding', 'gzip,deflate,sdch');
- $this->assertEquals(array(), $request->getEncodings()); // testing caching
-
- $request = new Request();
- $request->headers->set('Accept-Encoding', 'gzip,deflate,sdch');
- $this->assertEquals(array('gzip', 'deflate', 'sdch'), $request->getEncodings());
-
- $request = new Request();
- $request->headers->set('Accept-Encoding', 'gzip;q=0.4,deflate;q=0.9,compress;q=0.7');
- $this->assertEquals(array('deflate', 'compress', 'gzip'), $request->getEncodings());
- }
-
- public function testGetAcceptableContentTypes()
- {
- $request = new Request();
- $this->assertEquals(array(), $request->getAcceptableContentTypes());
- $request->headers->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*');
- $this->assertEquals(array(), $request->getAcceptableContentTypes()); // testing caching
-
- $request = new Request();
- $request->headers->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*');
- $this->assertEquals(array('application/vnd.wap.wmlscriptc', 'text/vnd.wap.wml', 'application/vnd.wap.xhtml+xml', 'application/xhtml+xml', 'text/html', 'multipart/mixed', '*/*'), $request->getAcceptableContentTypes());
- }
-
- public function testGetLanguages()
- {
- $request = new Request();
- $this->assertEquals(array(), $request->getLanguages());
-
- $request = new Request();
- $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6');
- $this->assertEquals(array('zh', 'en_US', 'en'), $request->getLanguages());
- $this->assertEquals(array('zh', 'en_US', 'en'), $request->getLanguages());
-
- $request = new Request();
- $request->headers->set('Accept-language', 'zh, en-us; q=0.6, en; q=0.8');
- $this->assertEquals(array('zh', 'en', 'en_US'), $request->getLanguages()); // Test out of order qvalues
-
- $request = new Request();
- $request->headers->set('Accept-language', 'zh, en, en-us');
- $this->assertEquals(array('zh', 'en', 'en_US'), $request->getLanguages()); // Test equal weighting without qvalues
-
- $request = new Request();
- $request->headers->set('Accept-language', 'zh; q=0.6, en, en-us; q=0.6');
- $this->assertEquals(array('en', 'zh', 'en_US'), $request->getLanguages()); // Test equal weighting with qvalues
-
- $request = new Request();
- $request->headers->set('Accept-language', 'zh, i-cherokee; q=0.6');
- $this->assertEquals(array('zh', 'cherokee'), $request->getLanguages());
- }
-
- public function testGetRequestFormat()
- {
- $request = new Request();
- $this->assertEquals('html', $request->getRequestFormat());
-
- // Ensure that setting different default values over time is possible,
- // aka. setRequestFormat determines the state.
- $this->assertEquals('json', $request->getRequestFormat('json'));
- $this->assertEquals('html', $request->getRequestFormat('html'));
-
- $request = new Request();
- $this->assertNull($request->getRequestFormat(null));
-
- $request = new Request();
- $this->assertNull($request->setRequestFormat('foo'));
- $this->assertEquals('foo', $request->getRequestFormat(null));
-
- $request = new Request(array('_format' => 'foo'));
- $this->assertEquals('html', $request->getRequestFormat());
- }
-
- public function testHasSession()
- {
- $request = new Request();
-
- $this->assertFalse($request->hasSession());
- $request->setSession(new Session(new MockArraySessionStorage()));
- $this->assertTrue($request->hasSession());
- }
-
- public function testGetSession()
- {
- $request = new Request();
-
- $request->setSession(new Session(new MockArraySessionStorage()));
- $this->assertTrue($request->hasSession());
-
- $session = $request->getSession();
- $this->assertObjectHasAttribute('storage', $session);
- $this->assertObjectHasAttribute('flashName', $session);
- $this->assertObjectHasAttribute('attributeName', $session);
- }
-
- public function testHasPreviousSession()
- {
- $request = new Request();
-
- $this->assertFalse($request->hasPreviousSession());
- $request->cookies->set('MOCKSESSID', 'foo');
- $this->assertFalse($request->hasPreviousSession());
- $request->setSession(new Session(new MockArraySessionStorage()));
- $this->assertTrue($request->hasPreviousSession());
- }
-
- public function testToString()
- {
- $request = new Request();
-
- $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6');
- $request->cookies->set('Foo', 'Bar');
-
- $asString = (string) $request;
-
- $this->assertContains('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $asString);
- $this->assertContains('Cookie: Foo=Bar', $asString);
-
- $request->cookies->set('Another', 'Cookie');
-
- $asString = (string) $request;
-
- $this->assertContains('Cookie: Foo=Bar; Another=Cookie', $asString);
- }
-
- public function testIsMethod()
- {
- $request = new Request();
- $request->setMethod('POST');
- $this->assertTrue($request->isMethod('POST'));
- $this->assertTrue($request->isMethod('post'));
- $this->assertFalse($request->isMethod('GET'));
- $this->assertFalse($request->isMethod('get'));
-
- $request->setMethod('GET');
- $this->assertTrue($request->isMethod('GET'));
- $this->assertTrue($request->isMethod('get'));
- $this->assertFalse($request->isMethod('POST'));
- $this->assertFalse($request->isMethod('post'));
- }
-
- /**
- * @dataProvider getBaseUrlData
- */
- public function testGetBaseUrl($uri, $server, $expectedBaseUrl, $expectedPathInfo)
- {
- $request = Request::create($uri, 'GET', array(), array(), array(), $server);
-
- $this->assertSame($expectedBaseUrl, $request->getBaseUrl(), 'baseUrl');
- $this->assertSame($expectedPathInfo, $request->getPathInfo(), 'pathInfo');
- }
-
- public function getBaseUrlData()
- {
- return array(
- array(
- '/fruit/strawberry/1234index.php/blah',
- array(
- 'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/fruit/index.php',
- 'SCRIPT_NAME' => '/fruit/index.php',
- 'PHP_SELF' => '/fruit/index.php',
- ),
- '/fruit',
- '/strawberry/1234index.php/blah',
- ),
- array(
- '/fruit/strawberry/1234index.php/blah',
- array(
- 'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/index.php',
- 'SCRIPT_NAME' => '/index.php',
- 'PHP_SELF' => '/index.php',
- ),
- '',
- '/fruit/strawberry/1234index.php/blah',
- ),
- array(
- '/foo%20bar/',
- array(
- 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php',
- 'SCRIPT_NAME' => '/foo bar/app.php',
- 'PHP_SELF' => '/foo bar/app.php',
- ),
- '/foo%20bar',
- '/',
- ),
- array(
- '/foo%20bar/home',
- array(
- 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php',
- 'SCRIPT_NAME' => '/foo bar/app.php',
- 'PHP_SELF' => '/foo bar/app.php',
- ),
- '/foo%20bar',
- '/home',
- ),
- array(
- '/foo%20bar/app.php/home',
- array(
- 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php',
- 'SCRIPT_NAME' => '/foo bar/app.php',
- 'PHP_SELF' => '/foo bar/app.php',
- ),
- '/foo%20bar/app.php',
- '/home',
- ),
- array(
- '/foo%20bar/app.php/home%3Dbaz',
- array(
- 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php',
- 'SCRIPT_NAME' => '/foo bar/app.php',
- 'PHP_SELF' => '/foo bar/app.php',
- ),
- '/foo%20bar/app.php',
- '/home%3Dbaz',
- ),
- array(
- '/foo/bar+baz',
- array(
- 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo/app.php',
- 'SCRIPT_NAME' => '/foo/app.php',
- 'PHP_SELF' => '/foo/app.php',
- ),
- '/foo',
- '/bar+baz',
- ),
- );
- }
-
- /**
- * @dataProvider urlencodedStringPrefixData
- */
- public function testUrlencodedStringPrefix($string, $prefix, $expect)
- {
- $request = new Request();
-
- $me = new \ReflectionMethod($request, 'getUrlencodedPrefix');
- $me->setAccessible(true);
-
- $this->assertSame($expect, $me->invoke($request, $string, $prefix));
- }
-
- public function urlencodedStringPrefixData()
- {
- return array(
- array('foo', 'foo', 'foo'),
- array('fo%6f', 'foo', 'fo%6f'),
- array('foo/bar', 'foo', 'foo'),
- array('fo%6f/bar', 'foo', 'fo%6f'),
- array('f%6f%6f/bar', 'foo', 'f%6f%6f'),
- array('%66%6F%6F/bar', 'foo', '%66%6F%6F'),
- array('fo+o/bar', 'fo+o', 'fo+o'),
- array('fo%2Bo/bar', 'fo+o', 'fo%2Bo'),
- );
- }
-
- private function disableHttpMethodParameterOverride()
- {
- $class = new \ReflectionClass('Symfony\\Component\\HttpFoundation\\Request');
- $property = $class->getProperty('httpMethodParameterOverride');
- $property->setAccessible(true);
- $property->setValue(false);
- }
-
- private function getRequestInstanceForClientIpTests($remoteAddr, $httpForwardedFor, $trustedProxies)
- {
- $request = new Request();
-
- $server = array('REMOTE_ADDR' => $remoteAddr);
- if (null !== $httpForwardedFor) {
- $server['HTTP_X_FORWARDED_FOR'] = $httpForwardedFor;
- }
-
- if ($trustedProxies) {
- Request::setTrustedProxies($trustedProxies, Request::HEADER_X_FORWARDED_ALL);
- }
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- return $request;
- }
-
- private function getRequestInstanceForClientIpsForwardedTests($remoteAddr, $httpForwarded, $trustedProxies)
- {
- $request = new Request();
-
- $server = array('REMOTE_ADDR' => $remoteAddr);
-
- if (null !== $httpForwarded) {
- $server['HTTP_FORWARDED'] = $httpForwarded;
- }
-
- if ($trustedProxies) {
- Request::setTrustedProxies($trustedProxies, Request::HEADER_FORWARDED);
- }
-
- $request->initialize(array(), array(), array(), array(), array(), $server);
-
- return $request;
- }
-
- public function testTrustedProxiesXForwardedFor()
- {
- $request = Request::create('http://example.com/');
- $request->server->set('REMOTE_ADDR', '3.3.3.3');
- $request->headers->set('X_FORWARDED_FOR', '1.1.1.1, 2.2.2.2');
- $request->headers->set('X_FORWARDED_HOST', 'foo.example.com:1234, real.example.com:8080');
- $request->headers->set('X_FORWARDED_PROTO', 'https');
- $request->headers->set('X_FORWARDED_PORT', 443);
-
- // no trusted proxies
- $this->assertEquals('3.3.3.3', $request->getClientIp());
- $this->assertEquals('example.com', $request->getHost());
- $this->assertEquals(80, $request->getPort());
- $this->assertFalse($request->isSecure());
-
- // disabling proxy trusting
- Request::setTrustedProxies(array(), Request::HEADER_X_FORWARDED_ALL);
- $this->assertEquals('3.3.3.3', $request->getClientIp());
- $this->assertEquals('example.com', $request->getHost());
- $this->assertEquals(80, $request->getPort());
- $this->assertFalse($request->isSecure());
-
- // request is forwarded by a non-trusted proxy
- Request::setTrustedProxies(array('2.2.2.2'), Request::HEADER_X_FORWARDED_ALL);
- $this->assertEquals('3.3.3.3', $request->getClientIp());
- $this->assertEquals('example.com', $request->getHost());
- $this->assertEquals(80, $request->getPort());
- $this->assertFalse($request->isSecure());
-
- // trusted proxy via setTrustedProxies()
- Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL);
- $this->assertEquals('1.1.1.1', $request->getClientIp());
- $this->assertEquals('foo.example.com', $request->getHost());
- $this->assertEquals(443, $request->getPort());
- $this->assertTrue($request->isSecure());
-
- // trusted proxy via setTrustedProxies()
- Request::setTrustedProxies(array('3.3.3.4', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL);
- $this->assertEquals('3.3.3.3', $request->getClientIp());
- $this->assertEquals('example.com', $request->getHost());
- $this->assertEquals(80, $request->getPort());
- $this->assertFalse($request->isSecure());
-
- // check various X_FORWARDED_PROTO header values
- Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL);
- $request->headers->set('X_FORWARDED_PROTO', 'ssl');
- $this->assertTrue($request->isSecure());
-
- $request->headers->set('X_FORWARDED_PROTO', 'https, http');
- $this->assertTrue($request->isSecure());
- }
-
- /**
- * @group legacy
- * @expectedDeprecation The "Symfony\Component\HttpFoundation\Request::setTrustedHeaderName()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.
- */
- public function testLegacyTrustedProxies()
- {
- $request = Request::create('http://example.com/');
- $request->server->set('REMOTE_ADDR', '3.3.3.3');
- $request->headers->set('X_FORWARDED_FOR', '1.1.1.1, 2.2.2.2');
- $request->headers->set('X_FORWARDED_HOST', 'foo.example.com, real.example.com:8080');
- $request->headers->set('X_FORWARDED_PROTO', 'https');
- $request->headers->set('X_FORWARDED_PORT', 443);
- $request->headers->set('X_MY_FOR', '3.3.3.3, 4.4.4.4');
- $request->headers->set('X_MY_HOST', 'my.example.com');
- $request->headers->set('X_MY_PROTO', 'http');
- $request->headers->set('X_MY_PORT', 81);
-
- Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL);
-
- // custom header names
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, 'X_MY_FOR');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, 'X_MY_HOST');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, 'X_MY_PORT');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, 'X_MY_PROTO');
- $this->assertEquals('4.4.4.4', $request->getClientIp());
- $this->assertEquals('my.example.com', $request->getHost());
- $this->assertEquals(81, $request->getPort());
- $this->assertFalse($request->isSecure());
-
- // disabling via empty header names
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, null);
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, null);
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, null);
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, null);
- $this->assertEquals('3.3.3.3', $request->getClientIp());
- $this->assertEquals('example.com', $request->getHost());
- $this->assertEquals(80, $request->getPort());
- $this->assertFalse($request->isSecure());
-
- //reset
- Request::setTrustedHeaderName(Request::HEADER_FORWARDED, 'FORWARDED');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, 'X_FORWARDED_FOR');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, 'X_FORWARDED_HOST');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, 'X_FORWARDED_PORT');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, 'X_FORWARDED_PROTO');
- }
-
- public function testTrustedProxiesForwarded()
- {
- $request = Request::create('http://example.com/');
- $request->server->set('REMOTE_ADDR', '3.3.3.3');
- $request->headers->set('FORWARDED', 'for=1.1.1.1, host=foo.example.com:8080, proto=https, for=2.2.2.2, host=real.example.com:8080');
-
- // no trusted proxies
- $this->assertEquals('3.3.3.3', $request->getClientIp());
- $this->assertEquals('example.com', $request->getHost());
- $this->assertEquals(80, $request->getPort());
- $this->assertFalse($request->isSecure());
-
- // disabling proxy trusting
- Request::setTrustedProxies(array(), Request::HEADER_FORWARDED);
- $this->assertEquals('3.3.3.3', $request->getClientIp());
- $this->assertEquals('example.com', $request->getHost());
- $this->assertEquals(80, $request->getPort());
- $this->assertFalse($request->isSecure());
-
- // request is forwarded by a non-trusted proxy
- Request::setTrustedProxies(array('2.2.2.2'), Request::HEADER_FORWARDED);
- $this->assertEquals('3.3.3.3', $request->getClientIp());
- $this->assertEquals('example.com', $request->getHost());
- $this->assertEquals(80, $request->getPort());
- $this->assertFalse($request->isSecure());
-
- // trusted proxy via setTrustedProxies()
- Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_FORWARDED);
- $this->assertEquals('1.1.1.1', $request->getClientIp());
- $this->assertEquals('foo.example.com', $request->getHost());
- $this->assertEquals(8080, $request->getPort());
- $this->assertTrue($request->isSecure());
-
- // trusted proxy via setTrustedProxies()
- Request::setTrustedProxies(array('3.3.3.4', '2.2.2.2'), Request::HEADER_FORWARDED);
- $this->assertEquals('3.3.3.3', $request->getClientIp());
- $this->assertEquals('example.com', $request->getHost());
- $this->assertEquals(80, $request->getPort());
- $this->assertFalse($request->isSecure());
-
- // check various X_FORWARDED_PROTO header values
- Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_FORWARDED);
- $request->headers->set('FORWARDED', 'proto=ssl');
- $this->assertTrue($request->isSecure());
-
- $request->headers->set('FORWARDED', 'proto=https, proto=http');
- $this->assertTrue($request->isSecure());
- }
-
- /**
- * @group legacy
- * @expectedException \InvalidArgumentException
- */
- public function testSetTrustedProxiesInvalidHeaderName()
- {
- Request::create('http://example.com/');
- Request::setTrustedHeaderName('bogus name', 'X_MY_FOR');
- }
-
- /**
- * @group legacy
- * @expectedException \InvalidArgumentException
- */
- public function testGetTrustedProxiesInvalidHeaderName()
- {
- Request::create('http://example.com/');
- Request::getTrustedHeaderName('bogus name');
- }
-
- /**
- * @dataProvider iisRequestUriProvider
- */
- public function testIISRequestUri($headers, $server, $expectedRequestUri)
- {
- $request = new Request();
- $request->headers->replace($headers);
- $request->server->replace($server);
-
- $this->assertEquals($expectedRequestUri, $request->getRequestUri(), '->getRequestUri() is correct');
-
- $subRequestUri = '/bar/foo';
- $subRequest = Request::create($subRequestUri, 'get', array(), array(), array(), $request->server->all());
- $this->assertEquals($subRequestUri, $subRequest->getRequestUri(), '->getRequestUri() is correct in sub request');
- }
-
- public function iisRequestUriProvider()
- {
- return array(
- array(
- array(
- 'X_ORIGINAL_URL' => '/foo/bar',
- ),
- array(),
- '/foo/bar',
- ),
- array(
- array(
- 'X_REWRITE_URL' => '/foo/bar',
- ),
- array(),
- '/foo/bar',
- ),
- array(
- array(),
- array(
- 'IIS_WasUrlRewritten' => '1',
- 'UNENCODED_URL' => '/foo/bar',
- ),
- '/foo/bar',
- ),
- array(
- array(
- 'X_ORIGINAL_URL' => '/foo/bar',
- ),
- array(
- 'HTTP_X_ORIGINAL_URL' => '/foo/bar',
- ),
- '/foo/bar',
- ),
- array(
- array(
- 'X_ORIGINAL_URL' => '/foo/bar',
- ),
- array(
- 'IIS_WasUrlRewritten' => '1',
- 'UNENCODED_URL' => '/foo/bar',
- ),
- '/foo/bar',
- ),
- array(
- array(
- 'X_ORIGINAL_URL' => '/foo/bar',
- ),
- array(
- 'HTTP_X_ORIGINAL_URL' => '/foo/bar',
- 'IIS_WasUrlRewritten' => '1',
- 'UNENCODED_URL' => '/foo/bar',
- ),
- '/foo/bar',
- ),
- array(
- array(),
- array(
- 'ORIG_PATH_INFO' => '/foo/bar',
- ),
- '/foo/bar',
- ),
- array(
- array(),
- array(
- 'ORIG_PATH_INFO' => '/foo/bar',
- 'QUERY_STRING' => 'foo=bar',
- ),
- '/foo/bar?foo=bar',
- ),
- );
- }
-
- public function testTrustedHosts()
- {
- // create a request
- $request = Request::create('/');
-
- // no trusted host set -> no host check
- $request->headers->set('host', 'evil.com');
- $this->assertEquals('evil.com', $request->getHost());
-
- // add a trusted domain and all its subdomains
- Request::setTrustedHosts(array('^([a-z]{9}\.)?trusted\.com$'));
-
- // untrusted host
- $request->headers->set('host', 'evil.com');
- try {
- $request->getHost();
- $this->fail('Request::getHost() should throw an exception when host is not trusted.');
- } catch (SuspiciousOperationException $e) {
- $this->assertEquals('Untrusted Host "evil.com".', $e->getMessage());
- }
-
- // trusted hosts
- $request->headers->set('host', 'trusted.com');
- $this->assertEquals('trusted.com', $request->getHost());
- $this->assertEquals(80, $request->getPort());
-
- $request->server->set('HTTPS', true);
- $request->headers->set('host', 'trusted.com');
- $this->assertEquals('trusted.com', $request->getHost());
- $this->assertEquals(443, $request->getPort());
- $request->server->set('HTTPS', false);
-
- $request->headers->set('host', 'trusted.com:8000');
- $this->assertEquals('trusted.com', $request->getHost());
- $this->assertEquals(8000, $request->getPort());
-
- $request->headers->set('host', 'subdomain.trusted.com');
- $this->assertEquals('subdomain.trusted.com', $request->getHost());
-
- // reset request for following tests
- Request::setTrustedHosts(array());
- }
-
- public function testFactory()
- {
- Request::setFactory(function (array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) {
- return new NewRequest();
- });
-
- $this->assertEquals('foo', Request::create('/')->getFoo());
-
- Request::setFactory(null);
- }
-
- /**
- * @dataProvider getLongHostNames
- */
- public function testVeryLongHosts($host)
- {
- $start = microtime(true);
-
- $request = Request::create('/');
- $request->headers->set('host', $host);
- $this->assertEquals($host, $request->getHost());
- $this->assertLessThan(5, microtime(true) - $start);
- }
-
- /**
- * @dataProvider getHostValidities
- */
- public function testHostValidity($host, $isValid, $expectedHost = null, $expectedPort = null)
- {
- $request = Request::create('/');
- $request->headers->set('host', $host);
-
- if ($isValid) {
- $this->assertSame($expectedHost ?: $host, $request->getHost());
- if ($expectedPort) {
- $this->assertSame($expectedPort, $request->getPort());
- }
- } else {
- if (method_exists($this, 'expectException')) {
- $this->expectException(SuspiciousOperationException::class);
- $this->expectExceptionMessage('Invalid Host');
- } else {
- $this->setExpectedException(SuspiciousOperationException::class, 'Invalid Host');
- }
-
- $request->getHost();
- }
- }
-
- public function getHostValidities()
- {
- return array(
- array('.a', false),
- array('a..', false),
- array('a.', true),
- array("\xE9", false),
- array('[::1]', true),
- array('[::1]:80', true, '[::1]', 80),
- array(str_repeat('.', 101), false),
- );
- }
-
- public function getLongHostNames()
- {
- return array(
- array('a'.str_repeat('.a', 40000)),
- array(str_repeat(':', 101)),
- );
- }
-
- /**
- * @dataProvider methodIdempotentProvider
- */
- public function testMethodIdempotent($method, $idempotent)
- {
- $request = new Request();
- $request->setMethod($method);
- $this->assertEquals($idempotent, $request->isMethodIdempotent());
- }
-
- public function methodIdempotentProvider()
- {
- return array(
- array('HEAD', true),
- array('GET', true),
- array('POST', false),
- array('PUT', true),
- array('PATCH', false),
- array('DELETE', true),
- array('PURGE', true),
- array('OPTIONS', true),
- array('TRACE', true),
- array('CONNECT', false),
- );
- }
-
- /**
- * @dataProvider methodSafeProvider
- */
- public function testMethodSafe($method, $safe)
- {
- $request = new Request();
- $request->setMethod($method);
- $this->assertEquals($safe, $request->isMethodSafe(false));
- }
-
- public function methodSafeProvider()
- {
- return array(
- array('HEAD', true),
- array('GET', true),
- array('POST', false),
- array('PUT', false),
- array('PATCH', false),
- array('DELETE', false),
- array('PURGE', false),
- array('OPTIONS', true),
- array('TRACE', true),
- array('CONNECT', false),
- );
- }
-
- /**
- * @group legacy
- * @expectedDeprecation Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since Symfony 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead.
- */
- public function testMethodSafeChecksCacheable()
- {
- $request = new Request();
- $request->setMethod('OPTIONS');
- $this->assertFalse($request->isMethodSafe());
- }
-
- /**
- * @dataProvider methodCacheableProvider
- */
- public function testMethodCacheable($method, $cacheable)
- {
- $request = new Request();
- $request->setMethod($method);
- $this->assertEquals($cacheable, $request->isMethodCacheable());
- }
-
- public function methodCacheableProvider()
- {
- return array(
- array('HEAD', true),
- array('GET', true),
- array('POST', false),
- array('PUT', false),
- array('PATCH', false),
- array('DELETE', false),
- array('PURGE', false),
- array('OPTIONS', false),
- array('TRACE', false),
- array('CONNECT', false),
- );
- }
-
- /**
- * @group legacy
- */
- public function testGetTrustedHeaderName()
- {
- Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_X_FORWARDED_ALL);
-
- $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_FORWARDED));
- $this->assertSame('X_FORWARDED_FOR', Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP));
- $this->assertSame('X_FORWARDED_HOST', Request::getTrustedHeaderName(Request::HEADER_CLIENT_HOST));
- $this->assertSame('X_FORWARDED_PORT', Request::getTrustedHeaderName(Request::HEADER_CLIENT_PORT));
- $this->assertSame('X_FORWARDED_PROTO', Request::getTrustedHeaderName(Request::HEADER_CLIENT_PROTO));
-
- Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_FORWARDED);
-
- $this->assertSame('FORWARDED', Request::getTrustedHeaderName(Request::HEADER_FORWARDED));
- $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP));
- $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_HOST));
- $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_PORT));
- $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_PROTO));
-
- Request::setTrustedHeaderName(Request::HEADER_FORWARDED, 'A');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, 'B');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, 'C');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, 'D');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, 'E');
-
- Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_FORWARDED);
-
- $this->assertSame('A', Request::getTrustedHeaderName(Request::HEADER_FORWARDED));
- $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP));
- $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_HOST));
- $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_PORT));
- $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_PROTO));
-
- Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_X_FORWARDED_ALL);
-
- $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_FORWARDED));
- $this->assertSame('B', Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP));
- $this->assertSame('C', Request::getTrustedHeaderName(Request::HEADER_CLIENT_HOST));
- $this->assertSame('D', Request::getTrustedHeaderName(Request::HEADER_CLIENT_PORT));
- $this->assertSame('E', Request::getTrustedHeaderName(Request::HEADER_CLIENT_PROTO));
-
- Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_FORWARDED);
-
- $this->assertSame('A', Request::getTrustedHeaderName(Request::HEADER_FORWARDED));
-
- //reset
- Request::setTrustedHeaderName(Request::HEADER_FORWARDED, 'FORWARDED');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, 'X_FORWARDED_FOR');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, 'X_FORWARDED_HOST');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, 'X_FORWARDED_PORT');
- Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, 'X_FORWARDED_PROTO');
- }
-
- /**
- * @dataProvider protocolVersionProvider
- */
- public function testProtocolVersion($serverProtocol, $trustedProxy, $via, $expected)
- {
- if ($trustedProxy) {
- Request::setTrustedProxies(array('1.1.1.1'), -1);
- }
-
- $request = new Request();
- $request->server->set('SERVER_PROTOCOL', $serverProtocol);
- $request->server->set('REMOTE_ADDR', '1.1.1.1');
- $request->headers->set('Via', $via);
-
- $this->assertSame($expected, $request->getProtocolVersion());
- }
-
- public function protocolVersionProvider()
- {
- return array(
- 'untrusted without via' => array('HTTP/2.0', false, '', 'HTTP/2.0'),
- 'untrusted with via' => array('HTTP/2.0', false, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/2.0'),
- 'trusted without via' => array('HTTP/2.0', true, '', 'HTTP/2.0'),
- 'trusted with via' => array('HTTP/2.0', true, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'),
- 'trusted with via and protocol name' => array('HTTP/2.0', true, 'HTTP/1.0 fred, HTTP/1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'),
- 'trusted with broken via' => array('HTTP/2.0', true, 'HTTP/1^0 foo', 'HTTP/2.0'),
- 'trusted with partially-broken via' => array('HTTP/2.0', true, '1.0 fred, foo', 'HTTP/1.0'),
- );
- }
-
- public function nonstandardRequestsData()
- {
- return array(
- array('', '', '/', 'http://host:8080/', ''),
- array('/', '', '/', 'http://host:8080/', ''),
-
- array('hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'),
- array('/hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'),
-
- array('', 'a=b', '/', 'http://host:8080/?a=b'),
- array('?a=b', 'a=b', '/', 'http://host:8080/?a=b'),
- array('/?a=b', 'a=b', '/', 'http://host:8080/?a=b'),
-
- array('x', 'a=b', '/x', 'http://host:8080/x?a=b'),
- array('x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'),
- array('/x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'),
-
- array('hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'),
- array('/hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'),
-
- array('hello/app.php/x', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'),
- array('hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'),
- array('/hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'),
- );
- }
-
- /**
- * @dataProvider nonstandardRequestsData
- */
- public function testNonstandardRequests($requestUri, $queryString, $expectedPathInfo, $expectedUri, $expectedBasePath = '', $expectedBaseUrl = null)
- {
- if (null === $expectedBaseUrl) {
- $expectedBaseUrl = $expectedBasePath;
- }
-
- $server = array(
- 'HTTP_HOST' => 'host:8080',
- 'SERVER_PORT' => '8080',
- 'QUERY_STRING' => $queryString,
- 'PHP_SELF' => '/hello/app.php',
- 'SCRIPT_FILENAME' => '/some/path/app.php',
- 'REQUEST_URI' => $requestUri,
- );
-
- $request = new Request(array(), array(), array(), array(), array(), $server);
-
- $this->assertEquals($expectedPathInfo, $request->getPathInfo());
- $this->assertEquals($expectedUri, $request->getUri());
- $this->assertEquals($queryString, $request->getQueryString());
- $this->assertEquals(8080, $request->getPort());
- $this->assertEquals('host:8080', $request->getHttpHost());
- $this->assertEquals($expectedBaseUrl, $request->getBaseUrl());
- $this->assertEquals($expectedBasePath, $request->getBasePath());
- }
-}
-
-class RequestContentProxy extends Request
-{
- public function getContent($asResource = false)
- {
- return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent'), '', '&');
- }
-}
-
-class NewRequest extends Request
-{
- public function getFoo()
- {
- return 'foo';
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php b/assets/php/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php
deleted file mode 100755
index ce85535..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php
+++ /dev/null
@@ -1,363 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\ResponseHeaderBag;
-use Symfony\Component\HttpFoundation\Cookie;
-
-/**
- * @group time-sensitive
- */
-class ResponseHeaderBagTest extends TestCase
-{
- public function testAllPreserveCase()
- {
- $headers = array(
- 'fOo' => 'BAR',
- 'ETag' => 'xyzzy',
- 'Content-MD5' => 'Q2hlY2sgSW50ZWdyaXR5IQ==',
- 'P3P' => 'CP="CAO PSA OUR"',
- 'WWW-Authenticate' => 'Basic realm="WallyWorld"',
- 'X-UA-Compatible' => 'IE=edge,chrome=1',
- 'X-XSS-Protection' => '1; mode=block',
- );
-
- $bag = new ResponseHeaderBag($headers);
- $allPreservedCase = $bag->allPreserveCase();
-
- foreach (array_keys($headers) as $headerName) {
- $this->assertArrayHasKey($headerName, $allPreservedCase, '->allPreserveCase() gets all input keys in original case');
- }
- }
-
- public function testCacheControlHeader()
- {
- $bag = new ResponseHeaderBag(array());
- $this->assertEquals('no-cache, private', $bag->get('Cache-Control'));
- $this->assertTrue($bag->hasCacheControlDirective('no-cache'));
-
- $bag = new ResponseHeaderBag(array('Cache-Control' => 'public'));
- $this->assertEquals('public', $bag->get('Cache-Control'));
- $this->assertTrue($bag->hasCacheControlDirective('public'));
-
- $bag = new ResponseHeaderBag(array('ETag' => 'abcde'));
- $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
- $this->assertTrue($bag->hasCacheControlDirective('private'));
- $this->assertTrue($bag->hasCacheControlDirective('must-revalidate'));
- $this->assertFalse($bag->hasCacheControlDirective('max-age'));
-
- $bag = new ResponseHeaderBag(array('Expires' => 'Wed, 16 Feb 2011 14:17:43 GMT'));
- $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
-
- $bag = new ResponseHeaderBag(array(
- 'Expires' => 'Wed, 16 Feb 2011 14:17:43 GMT',
- 'Cache-Control' => 'max-age=3600',
- ));
- $this->assertEquals('max-age=3600, private', $bag->get('Cache-Control'));
-
- $bag = new ResponseHeaderBag(array('Last-Modified' => 'abcde'));
- $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
-
- $bag = new ResponseHeaderBag(array('Etag' => 'abcde', 'Last-Modified' => 'abcde'));
- $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
-
- $bag = new ResponseHeaderBag(array('cache-control' => 'max-age=100'));
- $this->assertEquals('max-age=100, private', $bag->get('Cache-Control'));
-
- $bag = new ResponseHeaderBag(array('cache-control' => 's-maxage=100'));
- $this->assertEquals('s-maxage=100', $bag->get('Cache-Control'));
-
- $bag = new ResponseHeaderBag(array('cache-control' => 'private, max-age=100'));
- $this->assertEquals('max-age=100, private', $bag->get('Cache-Control'));
-
- $bag = new ResponseHeaderBag(array('cache-control' => 'public, max-age=100'));
- $this->assertEquals('max-age=100, public', $bag->get('Cache-Control'));
-
- $bag = new ResponseHeaderBag();
- $bag->set('Last-Modified', 'abcde');
- $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
-
- $bag = new ResponseHeaderBag();
- $bag->set('Cache-Control', array('public', 'must-revalidate'));
- $this->assertCount(1, $bag->get('Cache-Control', null, false));
- $this->assertEquals('must-revalidate, public', $bag->get('Cache-Control'));
-
- $bag = new ResponseHeaderBag();
- $bag->set('Cache-Control', 'public');
- $bag->set('Cache-Control', 'must-revalidate', false);
- $this->assertCount(1, $bag->get('Cache-Control', null, false));
- $this->assertEquals('must-revalidate, public', $bag->get('Cache-Control'));
- }
-
- public function testCacheControlClone()
- {
- $headers = array('foo' => 'bar');
- $bag1 = new ResponseHeaderBag($headers);
- $bag2 = new ResponseHeaderBag($bag1->allPreserveCase());
- $this->assertEquals($bag1->allPreserveCase(), $bag2->allPreserveCase());
- }
-
- public function testToStringIncludesCookieHeaders()
- {
- $bag = new ResponseHeaderBag(array());
- $bag->setCookie(new Cookie('foo', 'bar'));
-
- $this->assertSetCookieHeader('foo=bar; path=/; httponly', $bag);
-
- $bag->clearCookie('foo');
-
- $this->assertSetCookieHeader('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; max-age=-31536001; path=/; httponly', $bag);
- }
-
- public function testClearCookieSecureNotHttpOnly()
- {
- $bag = new ResponseHeaderBag(array());
-
- $bag->clearCookie('foo', '/', null, true, false);
-
- $this->assertSetCookieHeader('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; max-age=-31536001; path=/; secure', $bag);
- }
-
- public function testReplace()
- {
- $bag = new ResponseHeaderBag(array());
- $this->assertEquals('no-cache, private', $bag->get('Cache-Control'));
- $this->assertTrue($bag->hasCacheControlDirective('no-cache'));
-
- $bag->replace(array('Cache-Control' => 'public'));
- $this->assertEquals('public', $bag->get('Cache-Control'));
- $this->assertTrue($bag->hasCacheControlDirective('public'));
- }
-
- public function testReplaceWithRemove()
- {
- $bag = new ResponseHeaderBag(array());
- $this->assertEquals('no-cache, private', $bag->get('Cache-Control'));
- $this->assertTrue($bag->hasCacheControlDirective('no-cache'));
-
- $bag->remove('Cache-Control');
- $bag->replace(array());
- $this->assertEquals('no-cache, private', $bag->get('Cache-Control'));
- $this->assertTrue($bag->hasCacheControlDirective('no-cache'));
- }
-
- public function testCookiesWithSameNames()
- {
- $bag = new ResponseHeaderBag();
- $bag->setCookie(new Cookie('foo', 'bar', 0, '/path/foo', 'foo.bar'));
- $bag->setCookie(new Cookie('foo', 'bar', 0, '/path/bar', 'foo.bar'));
- $bag->setCookie(new Cookie('foo', 'bar', 0, '/path/bar', 'bar.foo'));
- $bag->setCookie(new Cookie('foo', 'bar'));
-
- $this->assertCount(4, $bag->getCookies());
- $this->assertEquals('foo=bar; path=/path/foo; domain=foo.bar; httponly', $bag->get('set-cookie'));
- $this->assertEquals(array(
- 'foo=bar; path=/path/foo; domain=foo.bar; httponly',
- 'foo=bar; path=/path/bar; domain=foo.bar; httponly',
- 'foo=bar; path=/path/bar; domain=bar.foo; httponly',
- 'foo=bar; path=/; httponly',
- ), $bag->get('set-cookie', null, false));
-
- $this->assertSetCookieHeader('foo=bar; path=/path/foo; domain=foo.bar; httponly', $bag);
- $this->assertSetCookieHeader('foo=bar; path=/path/bar; domain=foo.bar; httponly', $bag);
- $this->assertSetCookieHeader('foo=bar; path=/path/bar; domain=bar.foo; httponly', $bag);
- $this->assertSetCookieHeader('foo=bar; path=/; httponly', $bag);
-
- $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
-
- $this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/foo']);
- $this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/bar']);
- $this->assertArrayHasKey('foo', $cookies['bar.foo']['/path/bar']);
- $this->assertArrayHasKey('foo', $cookies['']['/']);
- }
-
- public function testRemoveCookie()
- {
- $bag = new ResponseHeaderBag();
- $this->assertFalse($bag->has('set-cookie'));
-
- $bag->setCookie(new Cookie('foo', 'bar', 0, '/path/foo', 'foo.bar'));
- $bag->setCookie(new Cookie('bar', 'foo', 0, '/path/bar', 'foo.bar'));
- $this->assertTrue($bag->has('set-cookie'));
-
- $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
- $this->assertArrayHasKey('/path/foo', $cookies['foo.bar']);
-
- $bag->removeCookie('foo', '/path/foo', 'foo.bar');
- $this->assertTrue($bag->has('set-cookie'));
-
- $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
- $this->assertArrayNotHasKey('/path/foo', $cookies['foo.bar']);
-
- $bag->removeCookie('bar', '/path/bar', 'foo.bar');
- $this->assertFalse($bag->has('set-cookie'));
-
- $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
- $this->assertArrayNotHasKey('foo.bar', $cookies);
- }
-
- public function testRemoveCookieWithNullRemove()
- {
- $bag = new ResponseHeaderBag();
- $bag->setCookie(new Cookie('foo', 'bar', 0));
- $bag->setCookie(new Cookie('bar', 'foo', 0));
-
- $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
- $this->assertArrayHasKey('/', $cookies['']);
-
- $bag->removeCookie('foo', null);
- $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
- $this->assertArrayNotHasKey('foo', $cookies['']['/']);
-
- $bag->removeCookie('bar', null);
- $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
- $this->assertFalse(isset($cookies['']['/']['bar']));
- }
-
- public function testSetCookieHeader()
- {
- $bag = new ResponseHeaderBag();
- $bag->set('set-cookie', 'foo=bar');
- $this->assertEquals(array(new Cookie('foo', 'bar', 0, '/', null, false, false, true)), $bag->getCookies());
-
- $bag->set('set-cookie', 'foo2=bar2', false);
- $this->assertEquals(array(
- new Cookie('foo', 'bar', 0, '/', null, false, false, true),
- new Cookie('foo2', 'bar2', 0, '/', null, false, false, true),
- ), $bag->getCookies());
-
- $bag->remove('set-cookie');
- $this->assertEquals(array(), $bag->getCookies());
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testGetCookiesWithInvalidArgument()
- {
- $bag = new ResponseHeaderBag();
-
- $bag->getCookies('invalid_argument');
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testMakeDispositionInvalidDisposition()
- {
- $headers = new ResponseHeaderBag();
-
- $headers->makeDisposition('invalid', 'foo.html');
- }
-
- /**
- * @dataProvider provideMakeDisposition
- */
- public function testMakeDisposition($disposition, $filename, $filenameFallback, $expected)
- {
- $headers = new ResponseHeaderBag();
-
- $this->assertEquals($expected, $headers->makeDisposition($disposition, $filename, $filenameFallback));
- }
-
- public function testToStringDoesntMessUpHeaders()
- {
- $headers = new ResponseHeaderBag();
-
- $headers->set('Location', 'http://www.symfony.com');
- $headers->set('Content-type', 'text/html');
-
- (string) $headers;
-
- $allHeaders = $headers->allPreserveCase();
- $this->assertEquals(array('http://www.symfony.com'), $allHeaders['Location']);
- $this->assertEquals(array('text/html'), $allHeaders['Content-type']);
- }
-
- public function provideMakeDisposition()
- {
- return array(
- array('attachment', 'foo.html', 'foo.html', 'attachment; filename="foo.html"'),
- array('attachment', 'foo.html', '', 'attachment; filename="foo.html"'),
- array('attachment', 'foo bar.html', '', 'attachment; filename="foo bar.html"'),
- array('attachment', 'foo "bar".html', '', 'attachment; filename="foo \\"bar\\".html"'),
- array('attachment', 'foo%20bar.html', 'foo bar.html', 'attachment; filename="foo bar.html"; filename*=utf-8\'\'foo%2520bar.html'),
- array('attachment', 'föö.html', 'foo.html', 'attachment; filename="foo.html"; filename*=utf-8\'\'f%C3%B6%C3%B6.html'),
- );
- }
-
- /**
- * @dataProvider provideMakeDispositionFail
- * @expectedException \InvalidArgumentException
- */
- public function testMakeDispositionFail($disposition, $filename)
- {
- $headers = new ResponseHeaderBag();
-
- $headers->makeDisposition($disposition, $filename);
- }
-
- public function provideMakeDispositionFail()
- {
- return array(
- array('attachment', 'foo%20bar.html'),
- array('attachment', 'foo/bar.html'),
- array('attachment', '/foo.html'),
- array('attachment', 'foo\bar.html'),
- array('attachment', '\foo.html'),
- array('attachment', 'föö.html'),
- );
- }
-
- public function testDateHeaderAddedOnCreation()
- {
- $now = time();
-
- $bag = new ResponseHeaderBag();
- $this->assertTrue($bag->has('Date'));
-
- $this->assertEquals($now, $bag->getDate('Date')->getTimestamp());
- }
-
- public function testDateHeaderCanBeSetOnCreation()
- {
- $someDate = 'Thu, 23 Mar 2017 09:15:12 GMT';
- $bag = new ResponseHeaderBag(array('Date' => $someDate));
-
- $this->assertEquals($someDate, $bag->get('Date'));
- }
-
- public function testDateHeaderWillBeRecreatedWhenRemoved()
- {
- $someDate = 'Thu, 23 Mar 2017 09:15:12 GMT';
- $bag = new ResponseHeaderBag(array('Date' => $someDate));
- $bag->remove('Date');
-
- // a (new) Date header is still present
- $this->assertTrue($bag->has('Date'));
- $this->assertNotEquals($someDate, $bag->get('Date'));
- }
-
- public function testDateHeaderWillBeRecreatedWhenHeadersAreReplaced()
- {
- $bag = new ResponseHeaderBag();
- $bag->replace(array());
-
- $this->assertTrue($bag->has('Date'));
- }
-
- private function assertSetCookieHeader($expected, ResponseHeaderBag $actual)
- {
- $this->assertRegExp('#^Set-Cookie:\s+'.preg_quote($expected, '#').'$#m', str_replace("\r\n", "\n", (string) $actual));
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/ResponseTest.php b/assets/php/vendor/symfony/http-foundation/Tests/ResponseTest.php
deleted file mode 100755
index 350d972..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/ResponseTest.php
+++ /dev/null
@@ -1,1003 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\Response;
-
-/**
- * @group time-sensitive
- */
-class ResponseTest extends ResponseTestCase
-{
- public function testCreate()
- {
- $response = Response::create('foo', 301, array('Foo' => 'bar'));
-
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
- $this->assertEquals(301, $response->getStatusCode());
- $this->assertEquals('bar', $response->headers->get('foo'));
- }
-
- public function testToString()
- {
- $response = new Response();
- $response = explode("\r\n", $response);
- $this->assertEquals('HTTP/1.0 200 OK', $response[0]);
- $this->assertEquals('Cache-Control: no-cache, private', $response[1]);
- }
-
- public function testClone()
- {
- $response = new Response();
- $responseClone = clone $response;
- $this->assertEquals($response, $responseClone);
- }
-
- public function testSendHeaders()
- {
- $response = new Response();
- $headers = $response->sendHeaders();
- $this->assertObjectHasAttribute('headers', $headers);
- $this->assertObjectHasAttribute('content', $headers);
- $this->assertObjectHasAttribute('version', $headers);
- $this->assertObjectHasAttribute('statusCode', $headers);
- $this->assertObjectHasAttribute('statusText', $headers);
- $this->assertObjectHasAttribute('charset', $headers);
- }
-
- public function testSend()
- {
- $response = new Response();
- $responseSend = $response->send();
- $this->assertObjectHasAttribute('headers', $responseSend);
- $this->assertObjectHasAttribute('content', $responseSend);
- $this->assertObjectHasAttribute('version', $responseSend);
- $this->assertObjectHasAttribute('statusCode', $responseSend);
- $this->assertObjectHasAttribute('statusText', $responseSend);
- $this->assertObjectHasAttribute('charset', $responseSend);
- }
-
- public function testGetCharset()
- {
- $response = new Response();
- $charsetOrigin = 'UTF-8';
- $response->setCharset($charsetOrigin);
- $charset = $response->getCharset();
- $this->assertEquals($charsetOrigin, $charset);
- }
-
- public function testIsCacheable()
- {
- $response = new Response();
- $this->assertFalse($response->isCacheable());
- }
-
- public function testIsCacheableWithErrorCode()
- {
- $response = new Response('', 500);
- $this->assertFalse($response->isCacheable());
- }
-
- public function testIsCacheableWithNoStoreDirective()
- {
- $response = new Response();
- $response->headers->set('cache-control', 'private');
- $this->assertFalse($response->isCacheable());
- }
-
- public function testIsCacheableWithSetTtl()
- {
- $response = new Response();
- $response->setTtl(10);
- $this->assertTrue($response->isCacheable());
- }
-
- public function testMustRevalidate()
- {
- $response = new Response();
- $this->assertFalse($response->mustRevalidate());
- }
-
- public function testMustRevalidateWithMustRevalidateCacheControlHeader()
- {
- $response = new Response();
- $response->headers->set('cache-control', 'must-revalidate');
-
- $this->assertTrue($response->mustRevalidate());
- }
-
- public function testMustRevalidateWithProxyRevalidateCacheControlHeader()
- {
- $response = new Response();
- $response->headers->set('cache-control', 'proxy-revalidate');
-
- $this->assertTrue($response->mustRevalidate());
- }
-
- public function testSetNotModified()
- {
- $response = new Response();
- $modified = $response->setNotModified();
- $this->assertObjectHasAttribute('headers', $modified);
- $this->assertObjectHasAttribute('content', $modified);
- $this->assertObjectHasAttribute('version', $modified);
- $this->assertObjectHasAttribute('statusCode', $modified);
- $this->assertObjectHasAttribute('statusText', $modified);
- $this->assertObjectHasAttribute('charset', $modified);
- $this->assertEquals(304, $modified->getStatusCode());
- }
-
- public function testIsSuccessful()
- {
- $response = new Response();
- $this->assertTrue($response->isSuccessful());
- }
-
- public function testIsNotModified()
- {
- $response = new Response();
- $modified = $response->isNotModified(new Request());
- $this->assertFalse($modified);
- }
-
- public function testIsNotModifiedNotSafe()
- {
- $request = Request::create('/homepage', 'POST');
-
- $response = new Response();
- $this->assertFalse($response->isNotModified($request));
- }
-
- public function testIsNotModifiedLastModified()
- {
- $before = 'Sun, 25 Aug 2013 18:32:31 GMT';
- $modified = 'Sun, 25 Aug 2013 18:33:31 GMT';
- $after = 'Sun, 25 Aug 2013 19:33:31 GMT';
-
- $request = new Request();
- $request->headers->set('If-Modified-Since', $modified);
-
- $response = new Response();
-
- $response->headers->set('Last-Modified', $modified);
- $this->assertTrue($response->isNotModified($request));
-
- $response->headers->set('Last-Modified', $before);
- $this->assertTrue($response->isNotModified($request));
-
- $response->headers->set('Last-Modified', $after);
- $this->assertFalse($response->isNotModified($request));
-
- $response->headers->set('Last-Modified', '');
- $this->assertFalse($response->isNotModified($request));
- }
-
- public function testIsNotModifiedEtag()
- {
- $etagOne = 'randomly_generated_etag';
- $etagTwo = 'randomly_generated_etag_2';
-
- $request = new Request();
- $request->headers->set('if_none_match', sprintf('%s, %s, %s', $etagOne, $etagTwo, 'etagThree'));
-
- $response = new Response();
-
- $response->headers->set('ETag', $etagOne);
- $this->assertTrue($response->isNotModified($request));
-
- $response->headers->set('ETag', $etagTwo);
- $this->assertTrue($response->isNotModified($request));
-
- $response->headers->set('ETag', '');
- $this->assertFalse($response->isNotModified($request));
- }
-
- public function testIsNotModifiedLastModifiedAndEtag()
- {
- $before = 'Sun, 25 Aug 2013 18:32:31 GMT';
- $modified = 'Sun, 25 Aug 2013 18:33:31 GMT';
- $after = 'Sun, 25 Aug 2013 19:33:31 GMT';
- $etag = 'randomly_generated_etag';
-
- $request = new Request();
- $request->headers->set('if_none_match', sprintf('%s, %s', $etag, 'etagThree'));
- $request->headers->set('If-Modified-Since', $modified);
-
- $response = new Response();
-
- $response->headers->set('ETag', $etag);
- $response->headers->set('Last-Modified', $after);
- $this->assertFalse($response->isNotModified($request));
-
- $response->headers->set('ETag', 'non-existent-etag');
- $response->headers->set('Last-Modified', $before);
- $this->assertFalse($response->isNotModified($request));
-
- $response->headers->set('ETag', $etag);
- $response->headers->set('Last-Modified', $modified);
- $this->assertTrue($response->isNotModified($request));
- }
-
- public function testIsNotModifiedIfModifiedSinceAndEtagWithoutLastModified()
- {
- $modified = 'Sun, 25 Aug 2013 18:33:31 GMT';
- $etag = 'randomly_generated_etag';
-
- $request = new Request();
- $request->headers->set('if_none_match', sprintf('%s, %s', $etag, 'etagThree'));
- $request->headers->set('If-Modified-Since', $modified);
-
- $response = new Response();
-
- $response->headers->set('ETag', $etag);
- $this->assertTrue($response->isNotModified($request));
-
- $response->headers->set('ETag', 'non-existent-etag');
- $this->assertFalse($response->isNotModified($request));
- }
-
- public function testIsValidateable()
- {
- $response = new Response('', 200, array('Last-Modified' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)));
- $this->assertTrue($response->isValidateable(), '->isValidateable() returns true if Last-Modified is present');
-
- $response = new Response('', 200, array('ETag' => '"12345"'));
- $this->assertTrue($response->isValidateable(), '->isValidateable() returns true if ETag is present');
-
- $response = new Response();
- $this->assertFalse($response->isValidateable(), '->isValidateable() returns false when no validator is present');
- }
-
- public function testGetDate()
- {
- $oneHourAgo = $this->createDateTimeOneHourAgo();
- $response = new Response('', 200, array('Date' => $oneHourAgo->format(DATE_RFC2822)));
- $date = $response->getDate();
- $this->assertEquals($oneHourAgo->getTimestamp(), $date->getTimestamp(), '->getDate() returns the Date header if present');
-
- $response = new Response();
- $date = $response->getDate();
- $this->assertEquals(time(), $date->getTimestamp(), '->getDate() returns the current Date if no Date header present');
-
- $response = new Response('', 200, array('Date' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)));
- $now = $this->createDateTimeNow();
- $response->headers->set('Date', $now->format(DATE_RFC2822));
- $date = $response->getDate();
- $this->assertEquals($now->getTimestamp(), $date->getTimestamp(), '->getDate() returns the date when the header has been modified');
-
- $response = new Response('', 200);
- $now = $this->createDateTimeNow();
- $response->headers->remove('Date');
- $date = $response->getDate();
- $this->assertEquals($now->getTimestamp(), $date->getTimestamp(), '->getDate() returns the current Date when the header has previously been removed');
- }
-
- public function testGetMaxAge()
- {
- $response = new Response();
- $response->headers->set('Cache-Control', 's-maxage=600, max-age=0');
- $this->assertEquals(600, $response->getMaxAge(), '->getMaxAge() uses s-maxage cache control directive when present');
-
- $response = new Response();
- $response->headers->set('Cache-Control', 'max-age=600');
- $this->assertEquals(600, $response->getMaxAge(), '->getMaxAge() falls back to max-age when no s-maxage directive present');
-
- $response = new Response();
- $response->headers->set('Cache-Control', 'must-revalidate');
- $response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(DATE_RFC2822));
- $this->assertEquals(3600, $response->getMaxAge(), '->getMaxAge() falls back to Expires when no max-age or s-maxage directive present');
-
- $response = new Response();
- $response->headers->set('Cache-Control', 'must-revalidate');
- $response->headers->set('Expires', -1);
- $this->assertEquals('Sat, 01 Jan 00 00:00:00 +0000', $response->getExpires()->format(DATE_RFC822));
-
- $response = new Response();
- $this->assertNull($response->getMaxAge(), '->getMaxAge() returns null if no freshness information available');
- }
-
- public function testSetSharedMaxAge()
- {
- $response = new Response();
- $response->setSharedMaxAge(20);
-
- $cacheControl = $response->headers->get('Cache-Control');
- $this->assertEquals('public, s-maxage=20', $cacheControl);
- }
-
- public function testIsPrivate()
- {
- $response = new Response();
- $response->headers->set('Cache-Control', 'max-age=100');
- $response->setPrivate();
- $this->assertEquals(100, $response->headers->getCacheControlDirective('max-age'), '->isPrivate() adds the private Cache-Control directive when set to true');
- $this->assertTrue($response->headers->getCacheControlDirective('private'), '->isPrivate() adds the private Cache-Control directive when set to true');
-
- $response = new Response();
- $response->headers->set('Cache-Control', 'public, max-age=100');
- $response->setPrivate();
- $this->assertEquals(100, $response->headers->getCacheControlDirective('max-age'), '->isPrivate() adds the private Cache-Control directive when set to true');
- $this->assertTrue($response->headers->getCacheControlDirective('private'), '->isPrivate() adds the private Cache-Control directive when set to true');
- $this->assertFalse($response->headers->hasCacheControlDirective('public'), '->isPrivate() removes the public Cache-Control directive');
- }
-
- public function testExpire()
- {
- $response = new Response();
- $response->headers->set('Cache-Control', 'max-age=100');
- $response->expire();
- $this->assertEquals(100, $response->headers->get('Age'), '->expire() sets the Age to max-age when present');
-
- $response = new Response();
- $response->headers->set('Cache-Control', 'max-age=100, s-maxage=500');
- $response->expire();
- $this->assertEquals(500, $response->headers->get('Age'), '->expire() sets the Age to s-maxage when both max-age and s-maxage are present');
-
- $response = new Response();
- $response->headers->set('Cache-Control', 'max-age=5, s-maxage=500');
- $response->headers->set('Age', '1000');
- $response->expire();
- $this->assertEquals(1000, $response->headers->get('Age'), '->expire() does nothing when the response is already stale/expired');
-
- $response = new Response();
- $response->expire();
- $this->assertFalse($response->headers->has('Age'), '->expire() does nothing when the response does not include freshness information');
-
- $response = new Response();
- $response->headers->set('Expires', -1);
- $response->expire();
- $this->assertNull($response->headers->get('Age'), '->expire() does not set the Age when the response is expired');
- }
-
- public function testGetTtl()
- {
- $response = new Response();
- $this->assertNull($response->getTtl(), '->getTtl() returns null when no Expires or Cache-Control headers are present');
-
- $response = new Response();
- $response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(DATE_RFC2822));
- $this->assertEquals(3600, $response->getTtl(), '->getTtl() uses the Expires header when no max-age is present');
-
- $response = new Response();
- $response->headers->set('Expires', $this->createDateTimeOneHourAgo()->format(DATE_RFC2822));
- $this->assertLessThan(0, $response->getTtl(), '->getTtl() returns negative values when Expires is in past');
-
- $response = new Response();
- $response->headers->set('Expires', $response->getDate()->format(DATE_RFC2822));
- $response->headers->set('Age', 0);
- $this->assertSame(0, $response->getTtl(), '->getTtl() correctly handles zero');
-
- $response = new Response();
- $response->headers->set('Cache-Control', 'max-age=60');
- $this->assertEquals(60, $response->getTtl(), '->getTtl() uses Cache-Control max-age when present');
- }
-
- public function testSetClientTtl()
- {
- $response = new Response();
- $response->setClientTtl(10);
-
- $this->assertEquals($response->getMaxAge(), $response->getAge() + 10);
- }
-
- public function testGetSetProtocolVersion()
- {
- $response = new Response();
-
- $this->assertEquals('1.0', $response->getProtocolVersion());
-
- $response->setProtocolVersion('1.1');
-
- $this->assertEquals('1.1', $response->getProtocolVersion());
- }
-
- public function testGetVary()
- {
- $response = new Response();
- $this->assertEquals(array(), $response->getVary(), '->getVary() returns an empty array if no Vary header is present');
-
- $response = new Response();
- $response->headers->set('Vary', 'Accept-Language');
- $this->assertEquals(array('Accept-Language'), $response->getVary(), '->getVary() parses a single header name value');
-
- $response = new Response();
- $response->headers->set('Vary', 'Accept-Language User-Agent X-Foo');
- $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->getVary() parses multiple header name values separated by spaces');
-
- $response = new Response();
- $response->headers->set('Vary', 'Accept-Language,User-Agent, X-Foo');
- $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->getVary() parses multiple header name values separated by commas');
-
- $vary = array('Accept-Language', 'User-Agent', 'X-foo');
-
- $response = new Response();
- $response->headers->set('Vary', $vary);
- $this->assertEquals($vary, $response->getVary(), '->getVary() parses multiple header name values in arrays');
-
- $response = new Response();
- $response->headers->set('Vary', 'Accept-Language, User-Agent, X-foo');
- $this->assertEquals($vary, $response->getVary(), '->getVary() parses multiple header name values in arrays');
- }
-
- public function testSetVary()
- {
- $response = new Response();
- $response->setVary('Accept-Language');
- $this->assertEquals(array('Accept-Language'), $response->getVary());
-
- $response->setVary('Accept-Language, User-Agent');
- $this->assertEquals(array('Accept-Language', 'User-Agent'), $response->getVary(), '->setVary() replace the vary header by default');
-
- $response->setVary('X-Foo', false);
- $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->setVary() doesn\'t wipe out earlier Vary headers if replace is set to false');
- }
-
- public function testDefaultContentType()
- {
- $headerMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\ResponseHeaderBag')->setMethods(array('set'))->getMock();
- $headerMock->expects($this->at(0))
- ->method('set')
- ->with('Content-Type', 'text/html');
- $headerMock->expects($this->at(1))
- ->method('set')
- ->with('Content-Type', 'text/html; charset=UTF-8');
-
- $response = new Response('foo');
- $response->headers = $headerMock;
-
- $response->prepare(new Request());
- }
-
- public function testContentTypeCharset()
- {
- $response = new Response();
- $response->headers->set('Content-Type', 'text/css');
-
- // force fixContentType() to be called
- $response->prepare(new Request());
-
- $this->assertEquals('text/css; charset=UTF-8', $response->headers->get('Content-Type'));
- }
-
- public function testPrepareDoesNothingIfContentTypeIsSet()
- {
- $response = new Response('foo');
- $response->headers->set('Content-Type', 'text/plain');
-
- $response->prepare(new Request());
-
- $this->assertEquals('text/plain; charset=UTF-8', $response->headers->get('content-type'));
- }
-
- public function testPrepareDoesNothingIfRequestFormatIsNotDefined()
- {
- $response = new Response('foo');
-
- $response->prepare(new Request());
-
- $this->assertEquals('text/html; charset=UTF-8', $response->headers->get('content-type'));
- }
-
- public function testPrepareSetContentType()
- {
- $response = new Response('foo');
- $request = Request::create('/');
- $request->setRequestFormat('json');
-
- $response->prepare($request);
-
- $this->assertEquals('application/json', $response->headers->get('content-type'));
- }
-
- public function testPrepareRemovesContentForHeadRequests()
- {
- $response = new Response('foo');
- $request = Request::create('/', 'HEAD');
-
- $length = 12345;
- $response->headers->set('Content-Length', $length);
- $response->prepare($request);
-
- $this->assertEquals('', $response->getContent());
- $this->assertEquals($length, $response->headers->get('Content-Length'), 'Content-Length should be as if it was GET; see RFC2616 14.13');
- }
-
- public function testPrepareRemovesContentForInformationalResponse()
- {
- $response = new Response('foo');
- $request = Request::create('/');
-
- $response->setContent('content');
- $response->setStatusCode(101);
- $response->prepare($request);
- $this->assertEquals('', $response->getContent());
- $this->assertFalse($response->headers->has('Content-Type'));
- $this->assertFalse($response->headers->has('Content-Type'));
-
- $response->setContent('content');
- $response->setStatusCode(304);
- $response->prepare($request);
- $this->assertEquals('', $response->getContent());
- $this->assertFalse($response->headers->has('Content-Type'));
- $this->assertFalse($response->headers->has('Content-Length'));
- }
-
- public function testPrepareRemovesContentLength()
- {
- $response = new Response('foo');
- $request = Request::create('/');
-
- $response->headers->set('Content-Length', 12345);
- $response->prepare($request);
- $this->assertEquals(12345, $response->headers->get('Content-Length'));
-
- $response->headers->set('Transfer-Encoding', 'chunked');
- $response->prepare($request);
- $this->assertFalse($response->headers->has('Content-Length'));
- }
-
- public function testPrepareSetsPragmaOnHttp10Only()
- {
- $request = Request::create('/', 'GET');
- $request->server->set('SERVER_PROTOCOL', 'HTTP/1.0');
-
- $response = new Response('foo');
- $response->prepare($request);
- $this->assertEquals('no-cache', $response->headers->get('pragma'));
- $this->assertEquals('-1', $response->headers->get('expires'));
-
- $request->server->set('SERVER_PROTOCOL', 'HTTP/1.1');
- $response = new Response('foo');
- $response->prepare($request);
- $this->assertFalse($response->headers->has('pragma'));
- $this->assertFalse($response->headers->has('expires'));
- }
-
- public function testSetCache()
- {
- $response = new Response();
- //array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public')
- try {
- $response->setCache(array('wrong option' => 'value'));
- $this->fail('->setCache() throws an InvalidArgumentException if an option is not supported');
- } catch (\Exception $e) {
- $this->assertInstanceOf('InvalidArgumentException', $e, '->setCache() throws an InvalidArgumentException if an option is not supported');
- $this->assertContains('"wrong option"', $e->getMessage());
- }
-
- $options = array('etag' => '"whatever"');
- $response->setCache($options);
- $this->assertEquals($response->getEtag(), '"whatever"');
-
- $now = $this->createDateTimeNow();
- $options = array('last_modified' => $now);
- $response->setCache($options);
- $this->assertEquals($response->getLastModified()->getTimestamp(), $now->getTimestamp());
-
- $options = array('max_age' => 100);
- $response->setCache($options);
- $this->assertEquals($response->getMaxAge(), 100);
-
- $options = array('s_maxage' => 200);
- $response->setCache($options);
- $this->assertEquals($response->getMaxAge(), 200);
-
- $this->assertTrue($response->headers->hasCacheControlDirective('public'));
- $this->assertFalse($response->headers->hasCacheControlDirective('private'));
-
- $response->setCache(array('public' => true));
- $this->assertTrue($response->headers->hasCacheControlDirective('public'));
- $this->assertFalse($response->headers->hasCacheControlDirective('private'));
-
- $response->setCache(array('public' => false));
- $this->assertFalse($response->headers->hasCacheControlDirective('public'));
- $this->assertTrue($response->headers->hasCacheControlDirective('private'));
-
- $response->setCache(array('private' => true));
- $this->assertFalse($response->headers->hasCacheControlDirective('public'));
- $this->assertTrue($response->headers->hasCacheControlDirective('private'));
-
- $response->setCache(array('private' => false));
- $this->assertTrue($response->headers->hasCacheControlDirective('public'));
- $this->assertFalse($response->headers->hasCacheControlDirective('private'));
-
- $response->setCache(array('immutable' => true));
- $this->assertTrue($response->headers->hasCacheControlDirective('immutable'));
-
- $response->setCache(array('immutable' => false));
- $this->assertFalse($response->headers->hasCacheControlDirective('immutable'));
- }
-
- public function testSendContent()
- {
- $response = new Response('test response rendering', 200);
-
- ob_start();
- $response->sendContent();
- $string = ob_get_clean();
- $this->assertContains('test response rendering', $string);
- }
-
- public function testSetPublic()
- {
- $response = new Response();
- $response->setPublic();
-
- $this->assertTrue($response->headers->hasCacheControlDirective('public'));
- $this->assertFalse($response->headers->hasCacheControlDirective('private'));
- }
-
- public function testSetImmutable()
- {
- $response = new Response();
- $response->setImmutable();
-
- $this->assertTrue($response->headers->hasCacheControlDirective('immutable'));
- }
-
- public function testIsImmutable()
- {
- $response = new Response();
- $response->setImmutable();
-
- $this->assertTrue($response->isImmutable());
- }
-
- public function testSetExpires()
- {
- $response = new Response();
- $response->setExpires(null);
-
- $this->assertNull($response->getExpires(), '->setExpires() remove the header when passed null');
-
- $now = $this->createDateTimeNow();
- $response->setExpires($now);
-
- $this->assertEquals($response->getExpires()->getTimestamp(), $now->getTimestamp());
- }
-
- public function testSetLastModified()
- {
- $response = new Response();
- $response->setLastModified($this->createDateTimeNow());
- $this->assertNotNull($response->getLastModified());
-
- $response->setLastModified(null);
- $this->assertNull($response->getLastModified());
- }
-
- public function testIsInvalid()
- {
- $response = new Response();
-
- try {
- $response->setStatusCode(99);
- $this->fail();
- } catch (\InvalidArgumentException $e) {
- $this->assertTrue($response->isInvalid());
- }
-
- try {
- $response->setStatusCode(650);
- $this->fail();
- } catch (\InvalidArgumentException $e) {
- $this->assertTrue($response->isInvalid());
- }
-
- $response = new Response('', 200);
- $this->assertFalse($response->isInvalid());
- }
-
- /**
- * @dataProvider getStatusCodeFixtures
- */
- public function testSetStatusCode($code, $text, $expectedText)
- {
- $response = new Response();
-
- $response->setStatusCode($code, $text);
-
- $statusText = new \ReflectionProperty($response, 'statusText');
- $statusText->setAccessible(true);
-
- $this->assertEquals($expectedText, $statusText->getValue($response));
- }
-
- public function getStatusCodeFixtures()
- {
- return array(
- array('200', null, 'OK'),
- array('200', false, ''),
- array('200', 'foo', 'foo'),
- array('199', null, 'unknown status'),
- array('199', false, ''),
- array('199', 'foo', 'foo'),
- );
- }
-
- public function testIsInformational()
- {
- $response = new Response('', 100);
- $this->assertTrue($response->isInformational());
-
- $response = new Response('', 200);
- $this->assertFalse($response->isInformational());
- }
-
- public function testIsRedirectRedirection()
- {
- foreach (array(301, 302, 303, 307) as $code) {
- $response = new Response('', $code);
- $this->assertTrue($response->isRedirection());
- $this->assertTrue($response->isRedirect());
- }
-
- $response = new Response('', 304);
- $this->assertTrue($response->isRedirection());
- $this->assertFalse($response->isRedirect());
-
- $response = new Response('', 200);
- $this->assertFalse($response->isRedirection());
- $this->assertFalse($response->isRedirect());
-
- $response = new Response('', 404);
- $this->assertFalse($response->isRedirection());
- $this->assertFalse($response->isRedirect());
-
- $response = new Response('', 301, array('Location' => '/good-uri'));
- $this->assertFalse($response->isRedirect('/bad-uri'));
- $this->assertTrue($response->isRedirect('/good-uri'));
- }
-
- public function testIsNotFound()
- {
- $response = new Response('', 404);
- $this->assertTrue($response->isNotFound());
-
- $response = new Response('', 200);
- $this->assertFalse($response->isNotFound());
- }
-
- public function testIsEmpty()
- {
- foreach (array(204, 304) as $code) {
- $response = new Response('', $code);
- $this->assertTrue($response->isEmpty());
- }
-
- $response = new Response('', 200);
- $this->assertFalse($response->isEmpty());
- }
-
- public function testIsForbidden()
- {
- $response = new Response('', 403);
- $this->assertTrue($response->isForbidden());
-
- $response = new Response('', 200);
- $this->assertFalse($response->isForbidden());
- }
-
- public function testIsOk()
- {
- $response = new Response('', 200);
- $this->assertTrue($response->isOk());
-
- $response = new Response('', 404);
- $this->assertFalse($response->isOk());
- }
-
- public function testIsServerOrClientError()
- {
- $response = new Response('', 404);
- $this->assertTrue($response->isClientError());
- $this->assertFalse($response->isServerError());
-
- $response = new Response('', 500);
- $this->assertFalse($response->isClientError());
- $this->assertTrue($response->isServerError());
- }
-
- public function testHasVary()
- {
- $response = new Response();
- $this->assertFalse($response->hasVary());
-
- $response->setVary('User-Agent');
- $this->assertTrue($response->hasVary());
- }
-
- public function testSetEtag()
- {
- $response = new Response('', 200, array('ETag' => '"12345"'));
- $response->setEtag();
-
- $this->assertNull($response->headers->get('Etag'), '->setEtag() removes Etags when call with null');
- }
-
- /**
- * @dataProvider validContentProvider
- */
- public function testSetContent($content)
- {
- $response = new Response();
- $response->setContent($content);
- $this->assertEquals((string) $content, $response->getContent());
- }
-
- /**
- * @expectedException \UnexpectedValueException
- * @dataProvider invalidContentProvider
- */
- public function testSetContentInvalid($content)
- {
- $response = new Response();
- $response->setContent($content);
- }
-
- public function testSettersAreChainable()
- {
- $response = new Response();
-
- $setters = array(
- 'setProtocolVersion' => '1.0',
- 'setCharset' => 'UTF-8',
- 'setPublic' => null,
- 'setPrivate' => null,
- 'setDate' => $this->createDateTimeNow(),
- 'expire' => null,
- 'setMaxAge' => 1,
- 'setSharedMaxAge' => 1,
- 'setTtl' => 1,
- 'setClientTtl' => 1,
- );
-
- foreach ($setters as $setter => $arg) {
- $this->assertEquals($response, $response->{$setter}($arg));
- }
- }
-
- public function testNoDeprecationsAreTriggered()
- {
- new DefaultResponse();
- $this->getMockBuilder(Response::class)->getMock();
-
- // we just need to ensure that subclasses of Response can be created without any deprecations
- // being triggered if the subclass does not override any final methods
- $this->addToAssertionCount(1);
- }
-
- public function validContentProvider()
- {
- return array(
- 'obj' => array(new StringableObject()),
- 'string' => array('Foo'),
- 'int' => array(2),
- );
- }
-
- public function invalidContentProvider()
- {
- return array(
- 'obj' => array(new \stdClass()),
- 'array' => array(array()),
- 'bool' => array(true, '1'),
- );
- }
-
- protected function createDateTimeOneHourAgo()
- {
- return $this->createDateTimeNow()->sub(new \DateInterval('PT1H'));
- }
-
- protected function createDateTimeOneHourLater()
- {
- return $this->createDateTimeNow()->add(new \DateInterval('PT1H'));
- }
-
- protected function createDateTimeNow()
- {
- $date = new \DateTime();
-
- return $date->setTimestamp(time());
- }
-
- protected function provideResponse()
- {
- return new Response();
- }
-
- /**
- * @see http://github.com/zendframework/zend-diactoros for the canonical source repository
- *
- * @author Fábio Pacheco
- * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com)
- * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
- */
- public function ianaCodesReasonPhrasesProvider()
- {
- if (!in_array('https', stream_get_wrappers(), true)) {
- $this->markTestSkipped('The "https" wrapper is not available');
- }
-
- $ianaHttpStatusCodes = new \DOMDocument();
-
- libxml_set_streams_context(stream_context_create(array(
- 'http' => array(
- 'method' => 'GET',
- 'timeout' => 30,
- ),
- )));
-
- $ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml');
- if (!$ianaHttpStatusCodes->relaxNGValidate(__DIR__.'/schema/http-status-codes.rng')) {
- self::fail('Invalid IANA\'s HTTP status code list.');
- }
-
- $ianaCodesReasonPhrases = array();
-
- $xpath = new \DOMXPath($ianaHttpStatusCodes);
- $xpath->registerNamespace('ns', 'http://www.iana.org/assignments');
-
- $records = $xpath->query('//ns:record');
- foreach ($records as $record) {
- $value = $xpath->query('.//ns:value', $record)->item(0)->nodeValue;
- $description = $xpath->query('.//ns:description', $record)->item(0)->nodeValue;
-
- if (in_array($description, array('Unassigned', '(Unused)'), true)) {
- continue;
- }
-
- if (preg_match('/^([0-9]+)\s*\-\s*([0-9]+)$/', $value, $matches)) {
- for ($value = $matches[1]; $value <= $matches[2]; ++$value) {
- $ianaCodesReasonPhrases[] = array($value, $description);
- }
- } else {
- $ianaCodesReasonPhrases[] = array($value, $description);
- }
- }
-
- return $ianaCodesReasonPhrases;
- }
-
- /**
- * @dataProvider ianaCodesReasonPhrasesProvider
- */
- public function testReasonPhraseDefaultsAgainstIana($code, $reasonPhrase)
- {
- $this->assertEquals($reasonPhrase, Response::$statusTexts[$code]);
- }
-}
-
-class StringableObject
-{
- public function __toString()
- {
- return 'Foo';
- }
-}
-
-class DefaultResponse extends Response
-{
-}
-
-class ExtendedResponse extends Response
-{
- public function setLastModified(\DateTime $date = null)
- {
- }
-
- public function getDate()
- {
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/ResponseTestCase.php b/assets/php/vendor/symfony/http-foundation/Tests/ResponseTestCase.php
deleted file mode 100755
index 4ead34c..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/ResponseTestCase.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Request;
-
-abstract class ResponseTestCase extends TestCase
-{
- public function testNoCacheControlHeaderOnAttachmentUsingHTTPSAndMSIE()
- {
- // Check for HTTPS and IE 8
- $request = new Request();
- $request->server->set('HTTPS', true);
- $request->server->set('HTTP_USER_AGENT', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)');
-
- $response = $this->provideResponse();
- $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
- $response->prepare($request);
-
- $this->assertFalse($response->headers->has('Cache-Control'));
-
- // Check for IE 10 and HTTPS
- $request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)');
-
- $response = $this->provideResponse();
- $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
- $response->prepare($request);
-
- $this->assertTrue($response->headers->has('Cache-Control'));
-
- // Check for IE 9 and HTTPS
- $request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)');
-
- $response = $this->provideResponse();
- $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
- $response->prepare($request);
-
- $this->assertTrue($response->headers->has('Cache-Control'));
-
- // Check for IE 9 and HTTP
- $request->server->set('HTTPS', false);
-
- $response = $this->provideResponse();
- $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
- $response->prepare($request);
-
- $this->assertTrue($response->headers->has('Cache-Control'));
-
- // Check for IE 8 and HTTP
- $request->server->set('HTTP_USER_AGENT', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)');
-
- $response = $this->provideResponse();
- $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
- $response->prepare($request);
-
- $this->assertTrue($response->headers->has('Cache-Control'));
-
- // Check for non-IE and HTTPS
- $request->server->set('HTTPS', true);
- $request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17');
-
- $response = $this->provideResponse();
- $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
- $response->prepare($request);
-
- $this->assertTrue($response->headers->has('Cache-Control'));
-
- // Check for non-IE and HTTP
- $request->server->set('HTTPS', false);
-
- $response = $this->provideResponse();
- $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"');
- $response->prepare($request);
-
- $this->assertTrue($response->headers->has('Cache-Control'));
- }
-
- abstract protected function provideResponse();
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/ServerBagTest.php b/assets/php/vendor/symfony/http-foundation/Tests/ServerBagTest.php
deleted file mode 100755
index f8becec..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/ServerBagTest.php
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\ServerBag;
-
-/**
- * ServerBagTest.
- *
- * @author Bulat Shakirzyanov <mallluhuct@gmail.com>
- */
-class ServerBagTest extends TestCase
-{
- public function testShouldExtractHeadersFromServerArray()
- {
- $server = array(
- 'SOME_SERVER_VARIABLE' => 'value',
- 'SOME_SERVER_VARIABLE2' => 'value',
- 'ROOT' => 'value',
- 'HTTP_CONTENT_TYPE' => 'text/html',
- 'HTTP_CONTENT_LENGTH' => '0',
- 'HTTP_ETAG' => 'asdf',
- 'PHP_AUTH_USER' => 'foo',
- 'PHP_AUTH_PW' => 'bar',
- );
-
- $bag = new ServerBag($server);
-
- $this->assertEquals(array(
- 'CONTENT_TYPE' => 'text/html',
- 'CONTENT_LENGTH' => '0',
- 'ETAG' => 'asdf',
- 'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'),
- 'PHP_AUTH_USER' => 'foo',
- 'PHP_AUTH_PW' => 'bar',
- ), $bag->getHeaders());
- }
-
- public function testHttpPasswordIsOptional()
- {
- $bag = new ServerBag(array('PHP_AUTH_USER' => 'foo'));
-
- $this->assertEquals(array(
- 'AUTHORIZATION' => 'Basic '.base64_encode('foo:'),
- 'PHP_AUTH_USER' => 'foo',
- 'PHP_AUTH_PW' => '',
- ), $bag->getHeaders());
- }
-
- public function testHttpBasicAuthWithPhpCgi()
- {
- $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:bar')));
-
- $this->assertEquals(array(
- 'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'),
- 'PHP_AUTH_USER' => 'foo',
- 'PHP_AUTH_PW' => 'bar',
- ), $bag->getHeaders());
- }
-
- public function testHttpBasicAuthWithPhpCgiBogus()
- {
- $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic_'.base64_encode('foo:bar')));
-
- // Username and passwords should not be set as the header is bogus
- $headers = $bag->getHeaders();
- $this->assertArrayNotHasKey('PHP_AUTH_USER', $headers);
- $this->assertArrayNotHasKey('PHP_AUTH_PW', $headers);
- }
-
- public function testHttpBasicAuthWithPhpCgiRedirect()
- {
- $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word')));
-
- $this->assertEquals(array(
- 'AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word'),
- 'PHP_AUTH_USER' => 'username',
- 'PHP_AUTH_PW' => 'pass:word',
- ), $bag->getHeaders());
- }
-
- public function testHttpBasicAuthWithPhpCgiEmptyPassword()
- {
- $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:')));
-
- $this->assertEquals(array(
- 'AUTHORIZATION' => 'Basic '.base64_encode('foo:'),
- 'PHP_AUTH_USER' => 'foo',
- 'PHP_AUTH_PW' => '',
- ), $bag->getHeaders());
- }
-
- public function testHttpDigestAuthWithPhpCgi()
- {
- $digest = 'Digest username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"';
- $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $digest));
-
- $this->assertEquals(array(
- 'AUTHORIZATION' => $digest,
- 'PHP_AUTH_DIGEST' => $digest,
- ), $bag->getHeaders());
- }
-
- public function testHttpDigestAuthWithPhpCgiBogus()
- {
- $digest = 'Digest_username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"';
- $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $digest));
-
- // Username and passwords should not be set as the header is bogus
- $headers = $bag->getHeaders();
- $this->assertArrayNotHasKey('PHP_AUTH_USER', $headers);
- $this->assertArrayNotHasKey('PHP_AUTH_PW', $headers);
- }
-
- public function testHttpDigestAuthWithPhpCgiRedirect()
- {
- $digest = 'Digest username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"';
- $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => $digest));
-
- $this->assertEquals(array(
- 'AUTHORIZATION' => $digest,
- 'PHP_AUTH_DIGEST' => $digest,
- ), $bag->getHeaders());
- }
-
- public function testOAuthBearerAuth()
- {
- $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo';
- $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $headerContent));
-
- $this->assertEquals(array(
- 'AUTHORIZATION' => $headerContent,
- ), $bag->getHeaders());
- }
-
- public function testOAuthBearerAuthWithRedirect()
- {
- $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo';
- $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => $headerContent));
-
- $this->assertEquals(array(
- 'AUTHORIZATION' => $headerContent,
- ), $bag->getHeaders());
- }
-
- /**
- * @see https://github.com/symfony/symfony/issues/17345
- */
- public function testItDoesNotOverwriteTheAuthorizationHeaderIfItIsAlreadySet()
- {
- $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo';
- $bag = new ServerBag(array('PHP_AUTH_USER' => 'foo', 'HTTP_AUTHORIZATION' => $headerContent));
-
- $this->assertEquals(array(
- 'AUTHORIZATION' => $headerContent,
- 'PHP_AUTH_USER' => 'foo',
- 'PHP_AUTH_PW' => '',
- ), $bag->getHeaders());
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php
deleted file mode 100755
index 724a0b9..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php
+++ /dev/null
@@ -1,186 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Attribute;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
-
-/**
- * Tests AttributeBag.
- *
- * @author Drak <drak@zikula.org>
- */
-class AttributeBagTest extends TestCase
-{
- private $array = array();
-
- /**
- * @var AttributeBag
- */
- private $bag;
-
- protected function setUp()
- {
- $this->array = array(
- 'hello' => 'world',
- 'always' => 'be happy',
- 'user.login' => 'drak',
- 'csrf.token' => array(
- 'a' => '1234',
- 'b' => '4321',
- ),
- 'category' => array(
- 'fishing' => array(
- 'first' => 'cod',
- 'second' => 'sole',
- ),
- ),
- );
- $this->bag = new AttributeBag('_sf2');
- $this->bag->initialize($this->array);
- }
-
- protected function tearDown()
- {
- $this->bag = null;
- $this->array = array();
- }
-
- public function testInitialize()
- {
- $bag = new AttributeBag();
- $bag->initialize($this->array);
- $this->assertEquals($this->array, $bag->all());
- $array = array('should' => 'change');
- $bag->initialize($array);
- $this->assertEquals($array, $bag->all());
- }
-
- public function testGetStorageKey()
- {
- $this->assertEquals('_sf2', $this->bag->getStorageKey());
- $attributeBag = new AttributeBag('test');
- $this->assertEquals('test', $attributeBag->getStorageKey());
- }
-
- public function testGetSetName()
- {
- $this->assertEquals('attributes', $this->bag->getName());
- $this->bag->setName('foo');
- $this->assertEquals('foo', $this->bag->getName());
- }
-
- /**
- * @dataProvider attributesProvider
- */
- public function testHas($key, $value, $exists)
- {
- $this->assertEquals($exists, $this->bag->has($key));
- }
-
- /**
- * @dataProvider attributesProvider
- */
- public function testGet($key, $value, $expected)
- {
- $this->assertEquals($value, $this->bag->get($key));
- }
-
- public function testGetDefaults()
- {
- $this->assertNull($this->bag->get('user2.login'));
- $this->assertEquals('default', $this->bag->get('user2.login', 'default'));
- }
-
- /**
- * @dataProvider attributesProvider
- */
- public function testSet($key, $value, $expected)
- {
- $this->bag->set($key, $value);
- $this->assertEquals($value, $this->bag->get($key));
- }
-
- public function testAll()
- {
- $this->assertEquals($this->array, $this->bag->all());
-
- $this->bag->set('hello', 'fabien');
- $array = $this->array;
- $array['hello'] = 'fabien';
- $this->assertEquals($array, $this->bag->all());
- }
-
- public function testReplace()
- {
- $array = array();
- $array['name'] = 'jack';
- $array['foo.bar'] = 'beep';
- $this->bag->replace($array);
- $this->assertEquals($array, $this->bag->all());
- $this->assertNull($this->bag->get('hello'));
- $this->assertNull($this->bag->get('always'));
- $this->assertNull($this->bag->get('user.login'));
- }
-
- public function testRemove()
- {
- $this->assertEquals('world', $this->bag->get('hello'));
- $this->bag->remove('hello');
- $this->assertNull($this->bag->get('hello'));
-
- $this->assertEquals('be happy', $this->bag->get('always'));
- $this->bag->remove('always');
- $this->assertNull($this->bag->get('always'));
-
- $this->assertEquals('drak', $this->bag->get('user.login'));
- $this->bag->remove('user.login');
- $this->assertNull($this->bag->get('user.login'));
- }
-
- public function testClear()
- {
- $this->bag->clear();
- $this->assertEquals(array(), $this->bag->all());
- }
-
- public function attributesProvider()
- {
- return array(
- array('hello', 'world', true),
- array('always', 'be happy', true),
- array('user.login', 'drak', true),
- array('csrf.token', array('a' => '1234', 'b' => '4321'), true),
- array('category', array('fishing' => array('first' => 'cod', 'second' => 'sole')), true),
- array('user2.login', null, false),
- array('never', null, false),
- array('bye', null, false),
- array('bye/for/now', null, false),
- );
- }
-
- public function testGetIterator()
- {
- $i = 0;
- foreach ($this->bag as $key => $val) {
- $this->assertEquals($this->array[$key], $val);
- ++$i;
- }
-
- $this->assertEquals(count($this->array), $i);
- }
-
- public function testCount()
- {
- $this->assertCount(count($this->array), $this->bag);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
deleted file mode 100755
index f074ce1..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Attribute;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag;
-
-/**
- * Tests NamespacedAttributeBag.
- *
- * @author Drak <drak@zikula.org>
- */
-class NamespacedAttributeBagTest extends TestCase
-{
- private $array = array();
-
- /**
- * @var NamespacedAttributeBag
- */
- private $bag;
-
- protected function setUp()
- {
- $this->array = array(
- 'hello' => 'world',
- 'always' => 'be happy',
- 'user.login' => 'drak',
- 'csrf.token' => array(
- 'a' => '1234',
- 'b' => '4321',
- ),
- 'category' => array(
- 'fishing' => array(
- 'first' => 'cod',
- 'second' => 'sole',
- ),
- ),
- );
- $this->bag = new NamespacedAttributeBag('_sf2', '/');
- $this->bag->initialize($this->array);
- }
-
- protected function tearDown()
- {
- $this->bag = null;
- $this->array = array();
- }
-
- public function testInitialize()
- {
- $bag = new NamespacedAttributeBag();
- $bag->initialize($this->array);
- $this->assertEquals($this->array, $this->bag->all());
- $array = array('should' => 'not stick');
- $bag->initialize($array);
-
- // should have remained the same
- $this->assertEquals($this->array, $this->bag->all());
- }
-
- public function testGetStorageKey()
- {
- $this->assertEquals('_sf2', $this->bag->getStorageKey());
- $attributeBag = new NamespacedAttributeBag('test');
- $this->assertEquals('test', $attributeBag->getStorageKey());
- }
-
- /**
- * @dataProvider attributesProvider
- */
- public function testHas($key, $value, $exists)
- {
- $this->assertEquals($exists, $this->bag->has($key));
- }
-
- /**
- * @dataProvider attributesProvider
- */
- public function testGet($key, $value, $expected)
- {
- $this->assertEquals($value, $this->bag->get($key));
- }
-
- public function testGetDefaults()
- {
- $this->assertNull($this->bag->get('user2.login'));
- $this->assertEquals('default', $this->bag->get('user2.login', 'default'));
- }
-
- /**
- * @dataProvider attributesProvider
- */
- public function testSet($key, $value, $expected)
- {
- $this->bag->set($key, $value);
- $this->assertEquals($value, $this->bag->get($key));
- }
-
- public function testAll()
- {
- $this->assertEquals($this->array, $this->bag->all());
-
- $this->bag->set('hello', 'fabien');
- $array = $this->array;
- $array['hello'] = 'fabien';
- $this->assertEquals($array, $this->bag->all());
- }
-
- public function testReplace()
- {
- $array = array();
- $array['name'] = 'jack';
- $array['foo.bar'] = 'beep';
- $this->bag->replace($array);
- $this->assertEquals($array, $this->bag->all());
- $this->assertNull($this->bag->get('hello'));
- $this->assertNull($this->bag->get('always'));
- $this->assertNull($this->bag->get('user.login'));
- }
-
- public function testRemove()
- {
- $this->assertEquals('world', $this->bag->get('hello'));
- $this->bag->remove('hello');
- $this->assertNull($this->bag->get('hello'));
-
- $this->assertEquals('be happy', $this->bag->get('always'));
- $this->bag->remove('always');
- $this->assertNull($this->bag->get('always'));
-
- $this->assertEquals('drak', $this->bag->get('user.login'));
- $this->bag->remove('user.login');
- $this->assertNull($this->bag->get('user.login'));
- }
-
- public function testRemoveExistingNamespacedAttribute()
- {
- $this->assertSame('cod', $this->bag->remove('category/fishing/first'));
- }
-
- public function testRemoveNonexistingNamespacedAttribute()
- {
- $this->assertNull($this->bag->remove('foo/bar/baz'));
- }
-
- public function testClear()
- {
- $this->bag->clear();
- $this->assertEquals(array(), $this->bag->all());
- }
-
- public function attributesProvider()
- {
- return array(
- array('hello', 'world', true),
- array('always', 'be happy', true),
- array('user.login', 'drak', true),
- array('csrf.token', array('a' => '1234', 'b' => '4321'), true),
- array('csrf.token/a', '1234', true),
- array('csrf.token/b', '4321', true),
- array('category', array('fishing' => array('first' => 'cod', 'second' => 'sole')), true),
- array('category/fishing', array('first' => 'cod', 'second' => 'sole'), true),
- array('category/fishing/missing/first', null, false),
- array('category/fishing/first', 'cod', true),
- array('category/fishing/second', 'sole', true),
- array('category/fishing/missing/second', null, false),
- array('user2.login', null, false),
- array('never', null, false),
- array('bye', null, false),
- array('bye/for/now', null, false),
- );
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
deleted file mode 100755
index fa8626a..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Flash;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag as FlashBag;
-
-/**
- * AutoExpireFlashBagTest.
- *
- * @author Drak <drak@zikula.org>
- */
-class AutoExpireFlashBagTest extends TestCase
-{
- /**
- * @var \Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag
- */
- private $bag;
-
- protected $array = array();
-
- protected function setUp()
- {
- parent::setUp();
- $this->bag = new FlashBag();
- $this->array = array('new' => array('notice' => array('A previous flash message')));
- $this->bag->initialize($this->array);
- }
-
- protected function tearDown()
- {
- $this->bag = null;
- parent::tearDown();
- }
-
- public function testInitialize()
- {
- $bag = new FlashBag();
- $array = array('new' => array('notice' => array('A previous flash message')));
- $bag->initialize($array);
- $this->assertEquals(array('A previous flash message'), $bag->peek('notice'));
- $array = array('new' => array(
- 'notice' => array('Something else'),
- 'error' => array('a'),
- ));
- $bag->initialize($array);
- $this->assertEquals(array('Something else'), $bag->peek('notice'));
- $this->assertEquals(array('a'), $bag->peek('error'));
- }
-
- public function testGetStorageKey()
- {
- $this->assertEquals('_symfony_flashes', $this->bag->getStorageKey());
- $attributeBag = new FlashBag('test');
- $this->assertEquals('test', $attributeBag->getStorageKey());
- }
-
- public function testGetSetName()
- {
- $this->assertEquals('flashes', $this->bag->getName());
- $this->bag->setName('foo');
- $this->assertEquals('foo', $this->bag->getName());
- }
-
- public function testPeek()
- {
- $this->assertEquals(array(), $this->bag->peek('non_existing'));
- $this->assertEquals(array('default'), $this->bag->peek('non_existing', array('default')));
- $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
- $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
- }
-
- public function testSet()
- {
- $this->bag->set('notice', 'Foo');
- $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
- }
-
- public function testHas()
- {
- $this->assertFalse($this->bag->has('nothing'));
- $this->assertTrue($this->bag->has('notice'));
- }
-
- public function testKeys()
- {
- $this->assertEquals(array('notice'), $this->bag->keys());
- }
-
- public function testPeekAll()
- {
- $array = array(
- 'new' => array(
- 'notice' => 'Foo',
- 'error' => 'Bar',
- ),
- );
-
- $this->bag->initialize($array);
- $this->assertEquals(array(
- 'notice' => 'Foo',
- 'error' => 'Bar',
- ), $this->bag->peekAll()
- );
-
- $this->assertEquals(array(
- 'notice' => 'Foo',
- 'error' => 'Bar',
- ), $this->bag->peekAll()
- );
- }
-
- public function testGet()
- {
- $this->assertEquals(array(), $this->bag->get('non_existing'));
- $this->assertEquals(array('default'), $this->bag->get('non_existing', array('default')));
- $this->assertEquals(array('A previous flash message'), $this->bag->get('notice'));
- $this->assertEquals(array(), $this->bag->get('notice'));
- }
-
- public function testSetAll()
- {
- $this->bag->setAll(array('a' => 'first', 'b' => 'second'));
- $this->assertFalse($this->bag->has('a'));
- $this->assertFalse($this->bag->has('b'));
- }
-
- public function testAll()
- {
- $this->bag->set('notice', 'Foo');
- $this->bag->set('error', 'Bar');
- $this->assertEquals(array(
- 'notice' => array('A previous flash message'),
- ), $this->bag->all()
- );
-
- $this->assertEquals(array(), $this->bag->all());
- }
-
- public function testClear()
- {
- $this->assertEquals(array('notice' => array('A previous flash message')), $this->bag->clear());
- }
-
- public function testDoNotRemoveTheNewFlashesWhenDisplayingTheExistingOnes()
- {
- $this->bag->add('success', 'Something');
- $this->bag->all();
-
- $this->assertEquals(array('new' => array('success' => array('Something')), 'display' => array()), $this->array);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php
deleted file mode 100755
index c4e75b1..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php
+++ /dev/null
@@ -1,132 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Flash;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
-
-/**
- * FlashBagTest.
- *
- * @author Drak <drak@zikula.org>
- */
-class FlashBagTest extends TestCase
-{
- /**
- * @var \Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface
- */
- private $bag;
-
- protected $array = array();
-
- protected function setUp()
- {
- parent::setUp();
- $this->bag = new FlashBag();
- $this->array = array('notice' => array('A previous flash message'));
- $this->bag->initialize($this->array);
- }
-
- protected function tearDown()
- {
- $this->bag = null;
- parent::tearDown();
- }
-
- public function testInitialize()
- {
- $bag = new FlashBag();
- $bag->initialize($this->array);
- $this->assertEquals($this->array, $bag->peekAll());
- $array = array('should' => array('change'));
- $bag->initialize($array);
- $this->assertEquals($array, $bag->peekAll());
- }
-
- public function testGetStorageKey()
- {
- $this->assertEquals('_symfony_flashes', $this->bag->getStorageKey());
- $attributeBag = new FlashBag('test');
- $this->assertEquals('test', $attributeBag->getStorageKey());
- }
-
- public function testGetSetName()
- {
- $this->assertEquals('flashes', $this->bag->getName());
- $this->bag->setName('foo');
- $this->assertEquals('foo', $this->bag->getName());
- }
-
- public function testPeek()
- {
- $this->assertEquals(array(), $this->bag->peek('non_existing'));
- $this->assertEquals(array('default'), $this->bag->peek('not_existing', array('default')));
- $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
- $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
- }
-
- public function testGet()
- {
- $this->assertEquals(array(), $this->bag->get('non_existing'));
- $this->assertEquals(array('default'), $this->bag->get('not_existing', array('default')));
- $this->assertEquals(array('A previous flash message'), $this->bag->get('notice'));
- $this->assertEquals(array(), $this->bag->get('notice'));
- }
-
- public function testAll()
- {
- $this->bag->set('notice', 'Foo');
- $this->bag->set('error', 'Bar');
- $this->assertEquals(array(
- 'notice' => array('Foo'),
- 'error' => array('Bar'), ), $this->bag->all()
- );
-
- $this->assertEquals(array(), $this->bag->all());
- }
-
- public function testSet()
- {
- $this->bag->set('notice', 'Foo');
- $this->bag->set('notice', 'Bar');
- $this->assertEquals(array('Bar'), $this->bag->peek('notice'));
- }
-
- public function testHas()
- {
- $this->assertFalse($this->bag->has('nothing'));
- $this->assertTrue($this->bag->has('notice'));
- }
-
- public function testKeys()
- {
- $this->assertEquals(array('notice'), $this->bag->keys());
- }
-
- public function testPeekAll()
- {
- $this->bag->set('notice', 'Foo');
- $this->bag->set('error', 'Bar');
- $this->assertEquals(array(
- 'notice' => array('Foo'),
- 'error' => array('Bar'),
- ), $this->bag->peekAll()
- );
- $this->assertTrue($this->bag->has('notice'));
- $this->assertTrue($this->bag->has('error'));
- $this->assertEquals(array(
- 'notice' => array('Foo'),
- 'error' => array('Bar'),
- ), $this->bag->peekAll()
- );
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/SessionTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/SessionTest.php
deleted file mode 100755
index 41720e4..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/SessionTest.php
+++ /dev/null
@@ -1,242 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Session;
-use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
-use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
-use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
-
-/**
- * SessionTest.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- * @author Robert Schönthal <seroscho@googlemail.com>
- * @author Drak <drak@zikula.org>
- */
-class SessionTest extends TestCase
-{
- /**
- * @var \Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface
- */
- protected $storage;
-
- /**
- * @var \Symfony\Component\HttpFoundation\Session\SessionInterface
- */
- protected $session;
-
- protected function setUp()
- {
- $this->storage = new MockArraySessionStorage();
- $this->session = new Session($this->storage, new AttributeBag(), new FlashBag());
- }
-
- protected function tearDown()
- {
- $this->storage = null;
- $this->session = null;
- }
-
- public function testStart()
- {
- $this->assertEquals('', $this->session->getId());
- $this->assertTrue($this->session->start());
- $this->assertNotEquals('', $this->session->getId());
- }
-
- public function testIsStarted()
- {
- $this->assertFalse($this->session->isStarted());
- $this->session->start();
- $this->assertTrue($this->session->isStarted());
- }
-
- public function testSetId()
- {
- $this->assertEquals('', $this->session->getId());
- $this->session->setId('0123456789abcdef');
- $this->session->start();
- $this->assertEquals('0123456789abcdef', $this->session->getId());
- }
-
- public function testSetName()
- {
- $this->assertEquals('MOCKSESSID', $this->session->getName());
- $this->session->setName('session.test.com');
- $this->session->start();
- $this->assertEquals('session.test.com', $this->session->getName());
- }
-
- public function testGet()
- {
- // tests defaults
- $this->assertNull($this->session->get('foo'));
- $this->assertEquals(1, $this->session->get('foo', 1));
- }
-
- /**
- * @dataProvider setProvider
- */
- public function testSet($key, $value)
- {
- $this->session->set($key, $value);
- $this->assertEquals($value, $this->session->get($key));
- }
-
- /**
- * @dataProvider setProvider
- */
- public function testHas($key, $value)
- {
- $this->session->set($key, $value);
- $this->assertTrue($this->session->has($key));
- $this->assertFalse($this->session->has($key.'non_value'));
- }
-
- public function testReplace()
- {
- $this->session->replace(array('happiness' => 'be good', 'symfony' => 'awesome'));
- $this->assertEquals(array('happiness' => 'be good', 'symfony' => 'awesome'), $this->session->all());
- $this->session->replace(array());
- $this->assertEquals(array(), $this->session->all());
- }
-
- /**
- * @dataProvider setProvider
- */
- public function testAll($key, $value, $result)
- {
- $this->session->set($key, $value);
- $this->assertEquals($result, $this->session->all());
- }
-
- /**
- * @dataProvider setProvider
- */
- public function testClear($key, $value)
- {
- $this->session->set('hi', 'fabien');
- $this->session->set($key, $value);
- $this->session->clear();
- $this->assertEquals(array(), $this->session->all());
- }
-
- public function setProvider()
- {
- return array(
- array('foo', 'bar', array('foo' => 'bar')),
- array('foo.bar', 'too much beer', array('foo.bar' => 'too much beer')),
- array('great', 'symfony is great', array('great' => 'symfony is great')),
- );
- }
-
- /**
- * @dataProvider setProvider
- */
- public function testRemove($key, $value)
- {
- $this->session->set('hi.world', 'have a nice day');
- $this->session->set($key, $value);
- $this->session->remove($key);
- $this->assertEquals(array('hi.world' => 'have a nice day'), $this->session->all());
- }
-
- public function testInvalidate()
- {
- $this->session->set('invalidate', 123);
- $this->session->invalidate();
- $this->assertEquals(array(), $this->session->all());
- }
-
- public function testMigrate()
- {
- $this->session->set('migrate', 321);
- $this->session->migrate();
- $this->assertEquals(321, $this->session->get('migrate'));
- }
-
- public function testMigrateDestroy()
- {
- $this->session->set('migrate', 333);
- $this->session->migrate(true);
- $this->assertEquals(333, $this->session->get('migrate'));
- }
-
- public function testSave()
- {
- $this->session->start();
- $this->session->save();
-
- $this->assertFalse($this->session->isStarted());
- }
-
- public function testGetId()
- {
- $this->assertEquals('', $this->session->getId());
- $this->session->start();
- $this->assertNotEquals('', $this->session->getId());
- }
-
- public function testGetFlashBag()
- {
- $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface', $this->session->getFlashBag());
- }
-
- public function testGetIterator()
- {
- $attributes = array('hello' => 'world', 'symfony' => 'rocks');
- foreach ($attributes as $key => $val) {
- $this->session->set($key, $val);
- }
-
- $i = 0;
- foreach ($this->session as $key => $val) {
- $this->assertEquals($attributes[$key], $val);
- ++$i;
- }
-
- $this->assertEquals(count($attributes), $i);
- }
-
- public function testGetCount()
- {
- $this->session->set('hello', 'world');
- $this->session->set('symfony', 'rocks');
-
- $this->assertCount(2, $this->session);
- }
-
- public function testGetMeta()
- {
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\MetadataBag', $this->session->getMetadataBag());
- }
-
- public function testIsEmpty()
- {
- $this->assertTrue($this->session->isEmpty());
-
- $this->session->set('hello', 'world');
- $this->assertFalse($this->session->isEmpty());
-
- $this->session->remove('hello');
- $this->assertTrue($this->session->isEmpty());
-
- $flash = $this->session->getFlashBag();
- $flash->set('hello', 'world');
- $this->assertFalse($this->session->isEmpty());
-
- $flash->get('hello');
- $this->assertTrue($this->session->isEmpty());
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php
deleted file mode 100755
index 3ac081e..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
-
-use PHPUnit\Framework\TestCase;
-
-/**
- * @requires PHP 7.0
- */
-class AbstractSessionHandlerTest extends TestCase
-{
- private static $server;
-
- public static function setUpBeforeClass()
- {
- $spec = array(
- 1 => array('file', '/dev/null', 'w'),
- 2 => array('file', '/dev/null', 'w'),
- );
- if (!self::$server = @proc_open('exec php -S localhost:8053', $spec, $pipes, __DIR__.'/Fixtures')) {
- self::markTestSkipped('PHP server unable to start.');
- }
- sleep(1);
- }
-
- public static function tearDownAfterClass()
- {
- if (self::$server) {
- proc_terminate(self::$server);
- proc_close(self::$server);
- }
- }
-
- /**
- * @dataProvider provideSession
- */
- public function testSession($fixture)
- {
- $context = array('http' => array('header' => "Cookie: sid=123abc\r\n"));
- $context = stream_context_create($context);
- $result = file_get_contents(sprintf('http://localhost:8053/%s.php', $fixture), false, $context);
-
- $this->assertStringEqualsFile(__DIR__.sprintf('/Fixtures/%s.expected', $fixture), $result);
- }
-
- public function provideSession()
- {
- foreach (glob(__DIR__.'/Fixtures/*.php') as $file) {
- yield array(pathinfo($file, PATHINFO_FILENAME));
- }
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/common.inc b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/common.inc
deleted file mode 100755
index 7a064c7..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/common.inc
+++ /dev/null
@@ -1,151 +0,0 @@
-<?php
-
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\AbstractSessionHandler;
-
-$parent = __DIR__;
-while (!@file_exists($parent.'/vendor/autoload.php')) {
- if (!@file_exists($parent)) {
- // open_basedir restriction in effect
- break;
- }
- if ($parent === dirname($parent)) {
- echo "vendor/autoload.php not found\n";
- exit(1);
- }
-
- $parent = dirname($parent);
-}
-
-require $parent.'/vendor/autoload.php';
-
-error_reporting(-1);
-ini_set('html_errors', 0);
-ini_set('display_errors', 1);
-ini_set('session.gc_probability', 0);
-ini_set('session.serialize_handler', 'php');
-ini_set('session.cookie_lifetime', 0);
-ini_set('session.cookie_domain', '');
-ini_set('session.cookie_secure', '');
-ini_set('session.cookie_httponly', '');
-ini_set('session.use_cookies', 1);
-ini_set('session.use_only_cookies', 1);
-ini_set('session.cache_expire', 180);
-ini_set('session.cookie_path', '/');
-ini_set('session.cookie_domain', '');
-ini_set('session.cookie_secure', 1);
-ini_set('session.cookie_httponly', 1);
-ini_set('session.use_strict_mode', 1);
-ini_set('session.lazy_write', 1);
-ini_set('session.name', 'sid');
-ini_set('session.save_path', __DIR__);
-ini_set('session.cache_limiter', '');
-
-header_remove('X-Powered-By');
-header('Content-Type: text/plain; charset=utf-8');
-
-register_shutdown_function(function () {
- echo "\n";
- session_write_close();
- print_r(headers_list());
- echo "shutdown\n";
-});
-ob_start();
-
-class TestSessionHandler extends AbstractSessionHandler
-{
- private $data;
-
- public function __construct($data = '')
- {
- $this->data = $data;
- }
-
- public function open($path, $name)
- {
- echo __FUNCTION__, "\n";
-
- return parent::open($path, $name);
- }
-
- public function validateId($sessionId)
- {
- echo __FUNCTION__, "\n";
-
- return parent::validateId($sessionId);
- }
-
- /**
- * {@inheritdoc}
- */
- public function read($sessionId)
- {
- echo __FUNCTION__, "\n";
-
- return parent::read($sessionId);
- }
-
- /**
- * {@inheritdoc}
- */
- public function updateTimestamp($sessionId, $data)
- {
- echo __FUNCTION__, "\n";
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function write($sessionId, $data)
- {
- echo __FUNCTION__, "\n";
-
- return parent::write($sessionId, $data);
- }
-
- /**
- * {@inheritdoc}
- */
- public function destroy($sessionId)
- {
- echo __FUNCTION__, "\n";
-
- return parent::destroy($sessionId);
- }
-
- public function close()
- {
- echo __FUNCTION__, "\n";
-
- return true;
- }
-
- public function gc($maxLifetime)
- {
- echo __FUNCTION__, "\n";
-
- return true;
- }
-
- protected function doRead($sessionId)
- {
- echo __FUNCTION__.': ', $this->data, "\n";
-
- return $this->data;
- }
-
- protected function doWrite($sessionId, $data)
- {
- echo __FUNCTION__.': ', $data, "\n";
-
- return true;
- }
-
- protected function doDestroy($sessionId)
- {
- echo __FUNCTION__, "\n";
-
- return true;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.expected b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.expected
deleted file mode 100755
index 8203714..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.expected
+++ /dev/null
@@ -1,17 +0,0 @@
-open
-validateId
-read
-doRead: abc|i:123;
-read
-
-write
-destroy
-doDestroy
-close
-Array
-(
- [0] => Content-Type: text/plain; charset=utf-8
- [1] => Cache-Control: max-age=10800, private, must-revalidate
- [2] => Set-Cookie: sid=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; secure; HttpOnly
-)
-shutdown
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.php
deleted file mode 100755
index 3cfc125..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-require __DIR__.'/common.inc';
-
-session_set_save_handler(new TestSessionHandler('abc|i:123;'), false);
-session_start();
-
-unset($_SESSION['abc']);
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.expected b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.expected
deleted file mode 100755
index 587adaf..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.expected
+++ /dev/null
@@ -1,14 +0,0 @@
-open
-validateId
-read
-doRead: abc|i:123;
-read
-123
-updateTimestamp
-close
-Array
-(
- [0] => Content-Type: text/plain; charset=utf-8
- [1] => Cache-Control: max-age=10800, private, must-revalidate
-)
-shutdown
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.php
deleted file mode 100755
index 3e62fb9..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-require __DIR__.'/common.inc';
-
-session_set_save_handler(new TestSessionHandler('abc|i:123;'), false);
-session_start();
-
-echo $_SESSION['abc'];
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.expected b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.expected
deleted file mode 100755
index baa5f2f..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.expected
+++ /dev/null
@@ -1,24 +0,0 @@
-open
-validateId
-read
-doRead: abc|i:123;
-read
-destroy
-doDestroy
-close
-open
-validateId
-read
-doRead: abc|i:123;
-read
-
-write
-doWrite: abc|i:123;
-close
-Array
-(
- [0] => Content-Type: text/plain; charset=utf-8
- [1] => Cache-Control: max-age=10800, private, must-revalidate
- [2] => Set-Cookie: sid=random_session_id; path=/; secure; HttpOnly
-)
-shutdown
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.php
deleted file mode 100755
index a0f635c..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-require __DIR__.'/common.inc';
-
-session_set_save_handler(new TestSessionHandler('abc|i:123;'), false);
-session_start();
-
-session_regenerate_id(true);
-
-ob_start(function ($buffer) { return str_replace(session_id(), 'random_session_id', $buffer); });
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.expected b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.expected
deleted file mode 100755
index 4533a10..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.expected
+++ /dev/null
@@ -1,20 +0,0 @@
-open
-validateId
-read
-doRead:
-read
-Array
-(
- [0] => bar
-)
-$_SESSION is not empty
-write
-destroy
-close
-$_SESSION is not empty
-Array
-(
- [0] => Content-Type: text/plain; charset=utf-8
- [1] => Cache-Control: max-age=0, private, must-revalidate
-)
-shutdown
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.php
deleted file mode 100755
index 96dca3c..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-require __DIR__.'/common.inc';
-
-use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
-use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
-
-$storage = new NativeSessionStorage();
-$storage->setSaveHandler(new TestSessionHandler());
-$flash = new FlashBag();
-$storage->registerBag($flash);
-$storage->start();
-
-$flash->add('foo', 'bar');
-
-print_r($flash->get('foo'));
-echo empty($_SESSION) ? '$_SESSION is empty' : '$_SESSION is not empty';
-echo "\n";
-
-$storage->save();
-
-echo empty($_SESSION) ? '$_SESSION is empty' : '$_SESSION is not empty';
-
-ob_start(function ($buffer) { return str_replace(session_id(), 'random_session_id', $buffer); });
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.expected b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.expected
deleted file mode 100755
index 33da0a5..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.expected
+++ /dev/null
@@ -1,15 +0,0 @@
-open
-validateId
-read
-doRead: abc|i:123;
-read
-
-updateTimestamp
-close
-Array
-(
- [0] => Content-Type: text/plain; charset=utf-8
- [1] => Cache-Control: max-age=10800, private, must-revalidate
- [2] => Set-Cookie: abc=def
-)
-shutdown
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.php
deleted file mode 100755
index ffb5b20..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-require __DIR__.'/common.inc';
-
-session_set_save_handler(new TestSessionHandler('abc|i:123;'), false);
-session_start();
-
-setcookie('abc', 'def');
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected
deleted file mode 100755
index 5de2d9e..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected
+++ /dev/null
@@ -1,24 +0,0 @@
-open
-validateId
-read
-doRead: abc|i:123;
-read
-updateTimestamp
-close
-open
-validateId
-read
-doRead: abc|i:123;
-read
-
-write
-destroy
-doDestroy
-close
-Array
-(
- [0] => Content-Type: text/plain; charset=utf-8
- [1] => Cache-Control: max-age=10800, private, must-revalidate
- [2] => Set-Cookie: abc=def
-)
-shutdown
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.php
deleted file mode 100755
index ec51193..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-require __DIR__.'/common.inc';
-
-setcookie('abc', 'def');
-
-session_set_save_handler(new TestSessionHandler('abc|i:123;'), false);
-session_start();
-session_write_close();
-session_start();
-
-$_SESSION['abc'] = 234;
-unset($_SESSION['abc']);
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php
deleted file mode 100755
index dda43c8..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php
+++ /dev/null
@@ -1,135 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHandler;
-
-/**
- * @requires extension memcache
- * @group time-sensitive
- * @group legacy
- */
-class MemcacheSessionHandlerTest extends TestCase
-{
- const PREFIX = 'prefix_';
- const TTL = 1000;
-
- /**
- * @var MemcacheSessionHandler
- */
- protected $storage;
-
- protected $memcache;
-
- protected function setUp()
- {
- if (defined('HHVM_VERSION')) {
- $this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcache class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289');
- }
-
- parent::setUp();
- $this->memcache = $this->getMockBuilder('Memcache')->getMock();
- $this->storage = new MemcacheSessionHandler(
- $this->memcache,
- array('prefix' => self::PREFIX, 'expiretime' => self::TTL)
- );
- }
-
- protected function tearDown()
- {
- $this->memcache = null;
- $this->storage = null;
- parent::tearDown();
- }
-
- public function testOpenSession()
- {
- $this->assertTrue($this->storage->open('', ''));
- }
-
- public function testCloseSession()
- {
- $this->assertTrue($this->storage->close());
- }
-
- public function testReadSession()
- {
- $this->memcache
- ->expects($this->once())
- ->method('get')
- ->with(self::PREFIX.'id')
- ;
-
- $this->assertEquals('', $this->storage->read('id'));
- }
-
- public function testWriteSession()
- {
- $this->memcache
- ->expects($this->once())
- ->method('set')
- ->with(self::PREFIX.'id', 'data', 0, $this->equalTo(time() + self::TTL, 2))
- ->will($this->returnValue(true))
- ;
-
- $this->assertTrue($this->storage->write('id', 'data'));
- }
-
- public function testDestroySession()
- {
- $this->memcache
- ->expects($this->once())
- ->method('delete')
- ->with(self::PREFIX.'id')
- ->will($this->returnValue(true))
- ;
-
- $this->assertTrue($this->storage->destroy('id'));
- }
-
- public function testGcSession()
- {
- $this->assertTrue($this->storage->gc(123));
- }
-
- /**
- * @dataProvider getOptionFixtures
- */
- public function testSupportedOptions($options, $supported)
- {
- try {
- new MemcacheSessionHandler($this->memcache, $options);
- $this->assertTrue($supported);
- } catch (\InvalidArgumentException $e) {
- $this->assertFalse($supported);
- }
- }
-
- public function getOptionFixtures()
- {
- return array(
- array(array('prefix' => 'session'), true),
- array(array('expiretime' => 100), true),
- array(array('prefix' => 'session', 'expiretime' => 200), true),
- array(array('expiretime' => 100, 'foo' => 'bar'), false),
- );
- }
-
- public function testGetConnection()
- {
- $method = new \ReflectionMethod($this->storage, 'getMemcache');
- $method->setAccessible(true);
-
- $this->assertInstanceOf('\Memcache', $method->invoke($this->storage));
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
deleted file mode 100755
index 2e7be35..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler;
-
-/**
- * @requires extension memcached
- * @group time-sensitive
- */
-class MemcachedSessionHandlerTest extends TestCase
-{
- const PREFIX = 'prefix_';
- const TTL = 1000;
-
- /**
- * @var MemcachedSessionHandler
- */
- protected $storage;
-
- protected $memcached;
-
- protected function setUp()
- {
- if (defined('HHVM_VERSION')) {
- $this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcached class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289');
- }
-
- parent::setUp();
-
- if (version_compare(phpversion('memcached'), '2.2.0', '>=') && version_compare(phpversion('memcached'), '3.0.0b1', '<')) {
- $this->markTestSkipped('Tests can only be run with memcached extension 2.1.0 or lower, or 3.0.0b1 or higher');
- }
-
- $this->memcached = $this->getMockBuilder('Memcached')->getMock();
- $this->storage = new MemcachedSessionHandler(
- $this->memcached,
- array('prefix' => self::PREFIX, 'expiretime' => self::TTL)
- );
- }
-
- protected function tearDown()
- {
- $this->memcached = null;
- $this->storage = null;
- parent::tearDown();
- }
-
- public function testOpenSession()
- {
- $this->assertTrue($this->storage->open('', ''));
- }
-
- public function testCloseSession()
- {
- $this->assertTrue($this->storage->close());
- }
-
- public function testReadSession()
- {
- $this->memcached
- ->expects($this->once())
- ->method('get')
- ->with(self::PREFIX.'id')
- ;
-
- $this->assertEquals('', $this->storage->read('id'));
- }
-
- public function testWriteSession()
- {
- $this->memcached
- ->expects($this->once())
- ->method('set')
- ->with(self::PREFIX.'id', 'data', $this->equalTo(time() + self::TTL, 2))
- ->will($this->returnValue(true))
- ;
-
- $this->assertTrue($this->storage->write('id', 'data'));
- }
-
- public function testDestroySession()
- {
- $this->memcached
- ->expects($this->once())
- ->method('delete')
- ->with(self::PREFIX.'id')
- ->will($this->returnValue(true))
- ;
-
- $this->assertTrue($this->storage->destroy('id'));
- }
-
- public function testGcSession()
- {
- $this->assertTrue($this->storage->gc(123));
- }
-
- /**
- * @dataProvider getOptionFixtures
- */
- public function testSupportedOptions($options, $supported)
- {
- try {
- new MemcachedSessionHandler($this->memcached, $options);
- $this->assertTrue($supported);
- } catch (\InvalidArgumentException $e) {
- $this->assertFalse($supported);
- }
- }
-
- public function getOptionFixtures()
- {
- return array(
- array(array('prefix' => 'session'), true),
- array(array('expiretime' => 100), true),
- array(array('prefix' => 'session', 'expiretime' => 200), true),
- array(array('expiretime' => 100, 'foo' => 'bar'), false),
- );
- }
-
- public function testGetConnection()
- {
- $method = new \ReflectionMethod($this->storage, 'getMemcached');
- $method->setAccessible(true);
-
- $this->assertInstanceOf('\Memcached', $method->invoke($this->storage));
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
deleted file mode 100755
index da05109..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
+++ /dev/null
@@ -1,333 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler;
-
-/**
- * @author Markus Bachmann <markus.bachmann@bachi.biz>
- * @group time-sensitive
- * @group legacy
- */
-class MongoDbSessionHandlerTest extends TestCase
-{
- /**
- * @var \PHPUnit_Framework_MockObject_MockObject
- */
- private $mongo;
- private $storage;
- public $options;
-
- protected function setUp()
- {
- parent::setUp();
-
- if (extension_loaded('mongodb')) {
- if (!class_exists('MongoDB\Client')) {
- $this->markTestSkipped('The mongodb/mongodb package is required.');
- }
- } elseif (!extension_loaded('mongo')) {
- $this->markTestSkipped('The Mongo or MongoDB extension is required.');
- }
-
- if (phpversion('mongodb')) {
- $mongoClass = 'MongoDB\Client';
- } else {
- $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient';
- }
-
- $this->mongo = $this->getMockBuilder($mongoClass)
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->options = array(
- 'id_field' => '_id',
- 'data_field' => 'data',
- 'time_field' => 'time',
- 'expiry_field' => 'expires_at',
- 'database' => 'sf2-test',
- 'collection' => 'session-test',
- );
-
- $this->storage = new MongoDbSessionHandler($this->mongo, $this->options);
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testConstructorShouldThrowExceptionForInvalidMongo()
- {
- new MongoDbSessionHandler(new \stdClass(), $this->options);
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testConstructorShouldThrowExceptionForMissingOptions()
- {
- new MongoDbSessionHandler($this->mongo, array());
- }
-
- public function testOpenMethodAlwaysReturnTrue()
- {
- $this->assertTrue($this->storage->open('test', 'test'), 'The "open" method should always return true');
- }
-
- public function testCloseMethodAlwaysReturnTrue()
- {
- $this->assertTrue($this->storage->close(), 'The "close" method should always return true');
- }
-
- public function testRead()
- {
- $collection = $this->createMongoCollectionMock();
-
- $this->mongo->expects($this->once())
- ->method('selectCollection')
- ->with($this->options['database'], $this->options['collection'])
- ->will($this->returnValue($collection));
-
- // defining the timeout before the actual method call
- // allows to test for "greater than" values in the $criteria
- $testTimeout = time() + 1;
-
- $collection->expects($this->once())
- ->method('findOne')
- ->will($this->returnCallback(function ($criteria) use ($testTimeout) {
- $this->assertArrayHasKey($this->options['id_field'], $criteria);
- $this->assertEquals($criteria[$this->options['id_field']], 'foo');
-
- $this->assertArrayHasKey($this->options['expiry_field'], $criteria);
- $this->assertArrayHasKey('$gte', $criteria[$this->options['expiry_field']]);
-
- if (phpversion('mongodb')) {
- $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$this->options['expiry_field']]['$gte']);
- $this->assertGreaterThanOrEqual(round((string) $criteria[$this->options['expiry_field']]['$gte'] / 1000), $testTimeout);
- } else {
- $this->assertInstanceOf('MongoDate', $criteria[$this->options['expiry_field']]['$gte']);
- $this->assertGreaterThanOrEqual($criteria[$this->options['expiry_field']]['$gte']->sec, $testTimeout);
- }
-
- $fields = array(
- $this->options['id_field'] => 'foo',
- );
-
- if (phpversion('mongodb')) {
- $fields[$this->options['data_field']] = new \MongoDB\BSON\Binary('bar', \MongoDB\BSON\Binary::TYPE_OLD_BINARY);
- $fields[$this->options['id_field']] = new \MongoDB\BSON\UTCDateTime(time() * 1000);
- } else {
- $fields[$this->options['data_field']] = new \MongoBinData('bar', \MongoBinData::BYTE_ARRAY);
- $fields[$this->options['id_field']] = new \MongoDate();
- }
-
- return $fields;
- }));
-
- $this->assertEquals('bar', $this->storage->read('foo'));
- }
-
- public function testWrite()
- {
- $collection = $this->createMongoCollectionMock();
-
- $this->mongo->expects($this->once())
- ->method('selectCollection')
- ->with($this->options['database'], $this->options['collection'])
- ->will($this->returnValue($collection));
-
- $data = array();
-
- $methodName = phpversion('mongodb') ? 'updateOne' : 'update';
-
- $collection->expects($this->once())
- ->method($methodName)
- ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) {
- $this->assertEquals(array($this->options['id_field'] => 'foo'), $criteria);
-
- if (phpversion('mongodb')) {
- $this->assertEquals(array('upsert' => true), $options);
- } else {
- $this->assertEquals(array('upsert' => true, 'multiple' => false), $options);
- }
-
- $data = $updateData['$set'];
- }));
-
- $expectedExpiry = time() + (int) ini_get('session.gc_maxlifetime');
- $this->assertTrue($this->storage->write('foo', 'bar'));
-
- if (phpversion('mongodb')) {
- $this->assertEquals('bar', $data[$this->options['data_field']]->getData());
- $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['time_field']]);
- $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['expiry_field']]);
- $this->assertGreaterThanOrEqual($expectedExpiry, round((string) $data[$this->options['expiry_field']] / 1000));
- } else {
- $this->assertEquals('bar', $data[$this->options['data_field']]->bin);
- $this->assertInstanceOf('MongoDate', $data[$this->options['time_field']]);
- $this->assertInstanceOf('MongoDate', $data[$this->options['expiry_field']]);
- $this->assertGreaterThanOrEqual($expectedExpiry, $data[$this->options['expiry_field']]->sec);
- }
- }
-
- public function testWriteWhenUsingExpiresField()
- {
- $this->options = array(
- 'id_field' => '_id',
- 'data_field' => 'data',
- 'time_field' => 'time',
- 'database' => 'sf2-test',
- 'collection' => 'session-test',
- 'expiry_field' => 'expiresAt',
- );
-
- $this->storage = new MongoDbSessionHandler($this->mongo, $this->options);
-
- $collection = $this->createMongoCollectionMock();
-
- $this->mongo->expects($this->once())
- ->method('selectCollection')
- ->with($this->options['database'], $this->options['collection'])
- ->will($this->returnValue($collection));
-
- $data = array();
-
- $methodName = phpversion('mongodb') ? 'updateOne' : 'update';
-
- $collection->expects($this->once())
- ->method($methodName)
- ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) {
- $this->assertEquals(array($this->options['id_field'] => 'foo'), $criteria);
-
- if (phpversion('mongodb')) {
- $this->assertEquals(array('upsert' => true), $options);
- } else {
- $this->assertEquals(array('upsert' => true, 'multiple' => false), $options);
- }
-
- $data = $updateData['$set'];
- }));
-
- $this->assertTrue($this->storage->write('foo', 'bar'));
-
- if (phpversion('mongodb')) {
- $this->assertEquals('bar', $data[$this->options['data_field']]->getData());
- $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['time_field']]);
- $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['expiry_field']]);
- } else {
- $this->assertEquals('bar', $data[$this->options['data_field']]->bin);
- $this->assertInstanceOf('MongoDate', $data[$this->options['time_field']]);
- $this->assertInstanceOf('MongoDate', $data[$this->options['expiry_field']]);
- }
- }
-
- public function testReplaceSessionData()
- {
- $collection = $this->createMongoCollectionMock();
-
- $this->mongo->expects($this->once())
- ->method('selectCollection')
- ->with($this->options['database'], $this->options['collection'])
- ->will($this->returnValue($collection));
-
- $data = array();
-
- $methodName = phpversion('mongodb') ? 'updateOne' : 'update';
-
- $collection->expects($this->exactly(2))
- ->method($methodName)
- ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) {
- $data = $updateData;
- }));
-
- $this->storage->write('foo', 'bar');
- $this->storage->write('foo', 'foobar');
-
- if (phpversion('mongodb')) {
- $this->assertEquals('foobar', $data['$set'][$this->options['data_field']]->getData());
- } else {
- $this->assertEquals('foobar', $data['$set'][$this->options['data_field']]->bin);
- }
- }
-
- public function testDestroy()
- {
- $collection = $this->createMongoCollectionMock();
-
- $this->mongo->expects($this->once())
- ->method('selectCollection')
- ->with($this->options['database'], $this->options['collection'])
- ->will($this->returnValue($collection));
-
- $methodName = phpversion('mongodb') ? 'deleteOne' : 'remove';
-
- $collection->expects($this->once())
- ->method($methodName)
- ->with(array($this->options['id_field'] => 'foo'));
-
- $this->assertTrue($this->storage->destroy('foo'));
- }
-
- public function testGc()
- {
- $collection = $this->createMongoCollectionMock();
-
- $this->mongo->expects($this->once())
- ->method('selectCollection')
- ->with($this->options['database'], $this->options['collection'])
- ->will($this->returnValue($collection));
-
- $methodName = phpversion('mongodb') ? 'deleteMany' : 'remove';
-
- $collection->expects($this->once())
- ->method($methodName)
- ->will($this->returnCallback(function ($criteria) {
- if (phpversion('mongodb')) {
- $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$this->options['expiry_field']]['$lt']);
- $this->assertGreaterThanOrEqual(time() - 1, round((string) $criteria[$this->options['expiry_field']]['$lt'] / 1000));
- } else {
- $this->assertInstanceOf('MongoDate', $criteria[$this->options['expiry_field']]['$lt']);
- $this->assertGreaterThanOrEqual(time() - 1, $criteria[$this->options['expiry_field']]['$lt']->sec);
- }
- }));
-
- $this->assertTrue($this->storage->gc(1));
- }
-
- public function testGetConnection()
- {
- $method = new \ReflectionMethod($this->storage, 'getMongo');
- $method->setAccessible(true);
-
- if (phpversion('mongodb')) {
- $mongoClass = 'MongoDB\Client';
- } else {
- $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient';
- }
-
- $this->assertInstanceOf($mongoClass, $method->invoke($this->storage));
- }
-
- private function createMongoCollectionMock()
- {
- $collectionClass = 'MongoCollection';
- if (phpversion('mongodb')) {
- $collectionClass = 'MongoDB\Collection';
- }
-
- $collection = $this->getMockBuilder($collectionClass)
- ->disableOriginalConstructor()
- ->getMock();
-
- return $collection;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
deleted file mode 100755
index a6264e5..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler;
-use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
-
-/**
- * Test class for NativeFileSessionHandler.
- *
- * @author Drak <drak@zikula.org>
- *
- * @runTestsInSeparateProcesses
- * @preserveGlobalState disabled
- */
-class NativeFileSessionHandlerTest extends TestCase
-{
- public function testConstruct()
- {
- $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler(sys_get_temp_dir()));
-
- $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName());
- $this->assertEquals('user', ini_get('session.save_handler'));
-
- $this->assertEquals(sys_get_temp_dir(), ini_get('session.save_path'));
- $this->assertEquals('TESTING', ini_get('session.name'));
- }
-
- /**
- * @dataProvider savePathDataProvider
- */
- public function testConstructSavePath($savePath, $expectedSavePath, $path)
- {
- $handler = new NativeFileSessionHandler($savePath);
- $this->assertEquals($expectedSavePath, ini_get('session.save_path'));
- $this->assertTrue(is_dir(realpath($path)));
-
- rmdir($path);
- }
-
- public function savePathDataProvider()
- {
- $base = sys_get_temp_dir();
-
- return array(
- array("$base/foo", "$base/foo", "$base/foo"),
- array("5;$base/foo", "5;$base/foo", "$base/foo"),
- array("5;0600;$base/foo", "5;0600;$base/foo", "$base/foo"),
- );
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testConstructException()
- {
- $handler = new NativeFileSessionHandler('something;invalid;with;too-many-args');
- }
-
- public function testConstructDefault()
- {
- $path = ini_get('session.save_path');
- $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler());
-
- $this->assertEquals($path, ini_get('session.save_path'));
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php
deleted file mode 100755
index 4a9fb60..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler;
-
-/**
- * Test class for NativeSessionHandler.
- *
- * @author Drak <drak@zikula.org>
- *
- * @runTestsInSeparateProcesses
- * @preserveGlobalState disabled
- * @group legacy
- */
-class NativeSessionHandlerTest extends TestCase
-{
- /**
- * @expectedDeprecation The Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the \SessionHandler class instead.
- */
- public function testConstruct()
- {
- $handler = new NativeSessionHandler();
-
- $this->assertInstanceOf('SessionHandler', $handler);
- $this->assertTrue($handler instanceof NativeSessionHandler);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php
deleted file mode 100755
index 718fd0f..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
-use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
-use Symfony\Component\HttpFoundation\Session\Session;
-
-/**
- * Test class for NullSessionHandler.
- *
- * @author Drak <drak@zikula.org>
- *
- * @runTestsInSeparateProcesses
- * @preserveGlobalState disabled
- */
-class NullSessionHandlerTest extends TestCase
-{
- public function testSaveHandlers()
- {
- $storage = $this->getStorage();
- $this->assertEquals('user', ini_get('session.save_handler'));
- }
-
- public function testSession()
- {
- session_id('nullsessionstorage');
- $storage = $this->getStorage();
- $session = new Session($storage);
- $this->assertNull($session->get('something'));
- $session->set('something', 'unique');
- $this->assertEquals('unique', $session->get('something'));
- }
-
- public function testNothingIsPersisted()
- {
- session_id('nullsessionstorage');
- $storage = $this->getStorage();
- $session = new Session($storage);
- $session->start();
- $this->assertEquals('nullsessionstorage', $session->getId());
- $this->assertNull($session->get('something'));
- }
-
- public function getStorage()
- {
- return new NativeSessionStorage(array(), new NullSessionHandler());
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
deleted file mode 100755
index 0a0e449..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
+++ /dev/null
@@ -1,411 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
-
-/**
- * @requires extension pdo_sqlite
- * @group time-sensitive
- */
-class PdoSessionHandlerTest extends TestCase
-{
- private $dbFile;
-
- protected function tearDown()
- {
- // make sure the temporary database file is deleted when it has been created (even when a test fails)
- if ($this->dbFile) {
- @unlink($this->dbFile);
- }
- parent::tearDown();
- }
-
- protected function getPersistentSqliteDsn()
- {
- $this->dbFile = tempnam(sys_get_temp_dir(), 'sf2_sqlite_sessions');
-
- return 'sqlite:'.$this->dbFile;
- }
-
- protected function getMemorySqlitePdo()
- {
- $pdo = new \PDO('sqlite::memory:');
- $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
- $storage = new PdoSessionHandler($pdo);
- $storage->createTable();
-
- return $pdo;
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testWrongPdoErrMode()
- {
- $pdo = $this->getMemorySqlitePdo();
- $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_SILENT);
-
- $storage = new PdoSessionHandler($pdo);
- }
-
- /**
- * @expectedException \RuntimeException
- */
- public function testInexistentTable()
- {
- $storage = new PdoSessionHandler($this->getMemorySqlitePdo(), array('db_table' => 'inexistent_table'));
- $storage->open('', 'sid');
- $storage->read('id');
- $storage->write('id', 'data');
- $storage->close();
- }
-
- /**
- * @expectedException \RuntimeException
- */
- public function testCreateTableTwice()
- {
- $storage = new PdoSessionHandler($this->getMemorySqlitePdo());
- $storage->createTable();
- }
-
- public function testWithLazyDsnConnection()
- {
- $dsn = $this->getPersistentSqliteDsn();
-
- $storage = new PdoSessionHandler($dsn);
- $storage->createTable();
- $storage->open('', 'sid');
- $data = $storage->read('id');
- $storage->write('id', 'data');
- $storage->close();
- $this->assertSame('', $data, 'New session returns empty string data');
-
- $storage->open('', 'sid');
- $data = $storage->read('id');
- $storage->close();
- $this->assertSame('data', $data, 'Written value can be read back correctly');
- }
-
- public function testWithLazySavePathConnection()
- {
- $dsn = $this->getPersistentSqliteDsn();
-
- // Open is called with what ini_set('session.save_path', $dsn) would mean
- $storage = new PdoSessionHandler(null);
- $storage->open($dsn, 'sid');
- $storage->createTable();
- $data = $storage->read('id');
- $storage->write('id', 'data');
- $storage->close();
- $this->assertSame('', $data, 'New session returns empty string data');
-
- $storage->open($dsn, 'sid');
- $data = $storage->read('id');
- $storage->close();
- $this->assertSame('data', $data, 'Written value can be read back correctly');
- }
-
- public function testReadWriteReadWithNullByte()
- {
- $sessionData = 'da'."\0".'ta';
-
- $storage = new PdoSessionHandler($this->getMemorySqlitePdo());
- $storage->open('', 'sid');
- $readData = $storage->read('id');
- $storage->write('id', $sessionData);
- $storage->close();
- $this->assertSame('', $readData, 'New session returns empty string data');
-
- $storage->open('', 'sid');
- $readData = $storage->read('id');
- $storage->close();
- $this->assertSame($sessionData, $readData, 'Written value can be read back correctly');
- }
-
- public function testReadConvertsStreamToString()
- {
- if (defined('HHVM_VERSION')) {
- $this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289');
- }
-
- $pdo = new MockPdo('pgsql');
- $pdo->prepareResult = $this->getMockBuilder('PDOStatement')->getMock();
-
- $content = 'foobar';
- $stream = $this->createStream($content);
-
- $pdo->prepareResult->expects($this->once())->method('fetchAll')
- ->will($this->returnValue(array(array($stream, 42, time()))));
-
- $storage = new PdoSessionHandler($pdo);
- $result = $storage->read('foo');
-
- $this->assertSame($content, $result);
- }
-
- public function testReadLockedConvertsStreamToString()
- {
- if (defined('HHVM_VERSION')) {
- $this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289');
- }
- if (ini_get('session.use_strict_mode')) {
- $this->markTestSkipped('Strict mode needs no locking for new sessions.');
- }
-
- $pdo = new MockPdo('pgsql');
- $selectStmt = $this->getMockBuilder('PDOStatement')->getMock();
- $insertStmt = $this->getMockBuilder('PDOStatement')->getMock();
-
- $pdo->prepareResult = function ($statement) use ($selectStmt, $insertStmt) {
- return 0 === strpos($statement, 'INSERT') ? $insertStmt : $selectStmt;
- };
-
- $content = 'foobar';
- $stream = $this->createStream($content);
- $exception = null;
-
- $selectStmt->expects($this->atLeast(2))->method('fetchAll')
- ->will($this->returnCallback(function () use (&$exception, $stream) {
- return $exception ? array(array($stream, 42, time())) : array();
- }));
-
- $insertStmt->expects($this->once())->method('execute')
- ->will($this->returnCallback(function () use (&$exception) {
- throw $exception = new \PDOException('', '23');
- }));
-
- $storage = new PdoSessionHandler($pdo);
- $result = $storage->read('foo');
-
- $this->assertSame($content, $result);
- }
-
- public function testReadingRequiresExactlySameId()
- {
- $storage = new PdoSessionHandler($this->getMemorySqlitePdo());
- $storage->open('', 'sid');
- $storage->write('id', 'data');
- $storage->write('test', 'data');
- $storage->write('space ', 'data');
- $storage->close();
-
- $storage->open('', 'sid');
- $readDataCaseSensitive = $storage->read('ID');
- $readDataNoCharFolding = $storage->read('tést');
- $readDataKeepSpace = $storage->read('space ');
- $readDataExtraSpace = $storage->read('space ');
- $storage->close();
-
- $this->assertSame('', $readDataCaseSensitive, 'Retrieval by ID should be case-sensitive (collation setting)');
- $this->assertSame('', $readDataNoCharFolding, 'Retrieval by ID should not do character folding (collation setting)');
- $this->assertSame('data', $readDataKeepSpace, 'Retrieval by ID requires spaces as-is');
- $this->assertSame('', $readDataExtraSpace, 'Retrieval by ID requires spaces as-is');
- }
-
- /**
- * Simulates session_regenerate_id(true) which will require an INSERT or UPDATE (replace).
- */
- public function testWriteDifferentSessionIdThanRead()
- {
- $storage = new PdoSessionHandler($this->getMemorySqlitePdo());
- $storage->open('', 'sid');
- $storage->read('id');
- $storage->destroy('id');
- $storage->write('new_id', 'data_of_new_session_id');
- $storage->close();
-
- $storage->open('', 'sid');
- $data = $storage->read('new_id');
- $storage->close();
-
- $this->assertSame('data_of_new_session_id', $data, 'Data of regenerated session id is available');
- }
-
- public function testWrongUsageStillWorks()
- {
- // wrong method sequence that should no happen, but still works
- $storage = new PdoSessionHandler($this->getMemorySqlitePdo());
- $storage->write('id', 'data');
- $storage->write('other_id', 'other_data');
- $storage->destroy('inexistent');
- $storage->open('', 'sid');
- $data = $storage->read('id');
- $otherData = $storage->read('other_id');
- $storage->close();
-
- $this->assertSame('data', $data);
- $this->assertSame('other_data', $otherData);
- }
-
- public function testSessionDestroy()
- {
- $pdo = $this->getMemorySqlitePdo();
- $storage = new PdoSessionHandler($pdo);
-
- $storage->open('', 'sid');
- $storage->read('id');
- $storage->write('id', 'data');
- $storage->close();
- $this->assertEquals(1, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn());
-
- $storage->open('', 'sid');
- $storage->read('id');
- $storage->destroy('id');
- $storage->close();
- $this->assertEquals(0, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn());
-
- $storage->open('', 'sid');
- $data = $storage->read('id');
- $storage->close();
- $this->assertSame('', $data, 'Destroyed session returns empty string');
- }
-
- /**
- * @runInSeparateProcess
- */
- public function testSessionGC()
- {
- $previousLifeTime = ini_set('session.gc_maxlifetime', 1000);
- $pdo = $this->getMemorySqlitePdo();
- $storage = new PdoSessionHandler($pdo);
-
- $storage->open('', 'sid');
- $storage->read('id');
- $storage->write('id', 'data');
- $storage->close();
-
- $storage->open('', 'sid');
- $storage->read('gc_id');
- ini_set('session.gc_maxlifetime', -1); // test that you can set lifetime of a session after it has been read
- $storage->write('gc_id', 'data');
- $storage->close();
- $this->assertEquals(2, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn(), 'No session pruned because gc not called');
-
- $storage->open('', 'sid');
- $data = $storage->read('gc_id');
- $storage->gc(-1);
- $storage->close();
-
- ini_set('session.gc_maxlifetime', $previousLifeTime);
-
- $this->assertSame('', $data, 'Session already considered garbage, so not returning data even if it is not pruned yet');
- $this->assertEquals(1, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn(), 'Expired session is pruned');
- }
-
- public function testGetConnection()
- {
- $storage = new PdoSessionHandler($this->getMemorySqlitePdo());
-
- $method = new \ReflectionMethod($storage, 'getConnection');
- $method->setAccessible(true);
-
- $this->assertInstanceOf('\PDO', $method->invoke($storage));
- }
-
- public function testGetConnectionConnectsIfNeeded()
- {
- $storage = new PdoSessionHandler('sqlite::memory:');
-
- $method = new \ReflectionMethod($storage, 'getConnection');
- $method->setAccessible(true);
-
- $this->assertInstanceOf('\PDO', $method->invoke($storage));
- }
-
- /**
- * @dataProvider provideUrlDsnPairs
- */
- public function testUrlDsn($url, $expectedDsn, $expectedUser = null, $expectedPassword = null)
- {
- $storage = new PdoSessionHandler($url);
-
- $this->assertAttributeEquals($expectedDsn, 'dsn', $storage);
-
- if (null !== $expectedUser) {
- $this->assertAttributeEquals($expectedUser, 'username', $storage);
- }
-
- if (null !== $expectedPassword) {
- $this->assertAttributeEquals($expectedPassword, 'password', $storage);
- }
- }
-
- public function provideUrlDsnPairs()
- {
- yield array('mysql://localhost/test', 'mysql:host=localhost;dbname=test;');
- yield array('mysql://localhost:56/test', 'mysql:host=localhost;port=56;dbname=test;');
- yield array('mysql2://root:pwd@localhost/test', 'mysql:host=localhost;dbname=test;', 'root', 'pwd');
- yield array('postgres://localhost/test', 'pgsql:host=localhost;dbname=test;');
- yield array('postgresql://localhost:5634/test', 'pgsql:host=localhost;port=5634;dbname=test;');
- yield array('postgres://root:pwd@localhost/test', 'pgsql:host=localhost;dbname=test;', 'root', 'pwd');
- yield 'sqlite relative path' => array('sqlite://localhost/tmp/test', 'sqlite:tmp/test');
- yield 'sqlite absolute path' => array('sqlite://localhost//tmp/test', 'sqlite:/tmp/test');
- yield 'sqlite relative path without host' => array('sqlite:///tmp/test', 'sqlite:tmp/test');
- yield 'sqlite absolute path without host' => array('sqlite3:////tmp/test', 'sqlite:/tmp/test');
- yield array('sqlite://localhost/:memory:', 'sqlite::memory:');
- yield array('mssql://localhost/test', 'sqlsrv:server=localhost;Database=test');
- yield array('mssql://localhost:56/test', 'sqlsrv:server=localhost,56;Database=test');
- }
-
- private function createStream($content)
- {
- $stream = tmpfile();
- fwrite($stream, $content);
- fseek($stream, 0);
-
- return $stream;
- }
-}
-
-class MockPdo extends \PDO
-{
- public $prepareResult;
- private $driverName;
- private $errorMode;
-
- public function __construct($driverName = null, $errorMode = null)
- {
- $this->driverName = $driverName;
- $this->errorMode = null !== $errorMode ?: \PDO::ERRMODE_EXCEPTION;
- }
-
- public function getAttribute($attribute)
- {
- if (\PDO::ATTR_ERRMODE === $attribute) {
- return $this->errorMode;
- }
-
- if (\PDO::ATTR_DRIVER_NAME === $attribute) {
- return $this->driverName;
- }
-
- return parent::getAttribute($attribute);
- }
-
- public function prepare($statement, $driverOptions = array())
- {
- return is_callable($this->prepareResult)
- ? call_user_func($this->prepareResult, $statement, $driverOptions)
- : $this->prepareResult;
- }
-
- public function beginTransaction()
- {
- }
-
- public function rollBack()
- {
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php
deleted file mode 100755
index b02c41a..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php
+++ /dev/null
@@ -1,189 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\AbstractSessionHandler;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler;
-
-class StrictSessionHandlerTest extends TestCase
-{
- public function testOpen()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('open')
- ->with('path', 'name')->willReturn(true);
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertInstanceOf('SessionUpdateTimestampHandlerInterface', $proxy);
- $this->assertInstanceOf(AbstractSessionHandler::class, $proxy);
- $this->assertTrue($proxy->open('path', 'name'));
- }
-
- public function testCloseSession()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('close')
- ->willReturn(true);
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertTrue($proxy->close());
- }
-
- public function testValidateIdOK()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('read')
- ->with('id')->willReturn('data');
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertTrue($proxy->validateId('id'));
- }
-
- public function testValidateIdKO()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('read')
- ->with('id')->willReturn('');
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertFalse($proxy->validateId('id'));
- }
-
- public function testRead()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('read')
- ->with('id')->willReturn('data');
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertSame('data', $proxy->read('id'));
- }
-
- public function testReadWithValidateIdOK()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('read')
- ->with('id')->willReturn('data');
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertTrue($proxy->validateId('id'));
- $this->assertSame('data', $proxy->read('id'));
- }
-
- public function testReadWithValidateIdMismatch()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->exactly(2))->method('read')
- ->withConsecutive(array('id1'), array('id2'))
- ->will($this->onConsecutiveCalls('data1', 'data2'));
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertTrue($proxy->validateId('id1'));
- $this->assertSame('data2', $proxy->read('id2'));
- }
-
- public function testUpdateTimestamp()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('write')
- ->with('id', 'data')->willReturn(true);
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertTrue($proxy->updateTimestamp('id', 'data'));
- }
-
- public function testWrite()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('write')
- ->with('id', 'data')->willReturn(true);
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertTrue($proxy->write('id', 'data'));
- }
-
- public function testWriteEmptyNewSession()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('read')
- ->with('id')->willReturn('');
- $handler->expects($this->never())->method('write');
- $handler->expects($this->once())->method('destroy')->willReturn(true);
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertFalse($proxy->validateId('id'));
- $this->assertSame('', $proxy->read('id'));
- $this->assertTrue($proxy->write('id', ''));
- }
-
- public function testWriteEmptyExistingSession()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('read')
- ->with('id')->willReturn('data');
- $handler->expects($this->never())->method('write');
- $handler->expects($this->once())->method('destroy')->willReturn(true);
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertSame('data', $proxy->read('id'));
- $this->assertTrue($proxy->write('id', ''));
- }
-
- public function testDestroy()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('destroy')
- ->with('id')->willReturn(true);
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertTrue($proxy->destroy('id'));
- }
-
- public function testDestroyNewSession()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('read')
- ->with('id')->willReturn('');
- $handler->expects($this->once())->method('destroy')->willReturn(true);
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertSame('', $proxy->read('id'));
- $this->assertTrue($proxy->destroy('id'));
- }
-
- public function testDestroyNonEmptyNewSession()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('read')
- ->with('id')->willReturn('');
- $handler->expects($this->once())->method('write')
- ->with('id', 'data')->willReturn(true);
- $handler->expects($this->once())->method('destroy')
- ->with('id')->willReturn(true);
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertSame('', $proxy->read('id'));
- $this->assertTrue($proxy->write('id', 'data'));
- $this->assertTrue($proxy->destroy('id'));
- }
-
- public function testGc()
- {
- $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $handler->expects($this->once())->method('gc')
- ->with(123)->willReturn(true);
- $proxy = new StrictSessionHandler($handler);
-
- $this->assertTrue($proxy->gc(123));
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php
deleted file mode 100755
index 898a7d1..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler;
-
-/**
- * @author Adrien Brault <adrien.brault@gmail.com>
- *
- * @group legacy
- */
-class WriteCheckSessionHandlerTest extends TestCase
-{
- public function test()
- {
- $wrappedSessionHandlerMock = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock);
-
- $wrappedSessionHandlerMock
- ->expects($this->once())
- ->method('close')
- ->with()
- ->will($this->returnValue(true))
- ;
-
- $this->assertTrue($writeCheckSessionHandler->close());
- }
-
- public function testWrite()
- {
- $wrappedSessionHandlerMock = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock);
-
- $wrappedSessionHandlerMock
- ->expects($this->once())
- ->method('write')
- ->with('foo', 'bar')
- ->will($this->returnValue(true))
- ;
-
- $this->assertTrue($writeCheckSessionHandler->write('foo', 'bar'));
- }
-
- public function testSkippedWrite()
- {
- $wrappedSessionHandlerMock = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock);
-
- $wrappedSessionHandlerMock
- ->expects($this->once())
- ->method('read')
- ->with('foo')
- ->will($this->returnValue('bar'))
- ;
-
- $wrappedSessionHandlerMock
- ->expects($this->never())
- ->method('write')
- ;
-
- $this->assertEquals('bar', $writeCheckSessionHandler->read('foo'));
- $this->assertTrue($writeCheckSessionHandler->write('foo', 'bar'));
- }
-
- public function testNonSkippedWrite()
- {
- $wrappedSessionHandlerMock = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock);
-
- $wrappedSessionHandlerMock
- ->expects($this->once())
- ->method('read')
- ->with('foo')
- ->will($this->returnValue('bar'))
- ;
-
- $wrappedSessionHandlerMock
- ->expects($this->once())
- ->method('write')
- ->with('foo', 'baZZZ')
- ->will($this->returnValue(true))
- ;
-
- $this->assertEquals('bar', $writeCheckSessionHandler->read('foo'));
- $this->assertTrue($writeCheckSessionHandler->write('foo', 'baZZZ'));
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php
deleted file mode 100755
index 69cf616..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
-
-/**
- * Test class for MetadataBag.
- *
- * @group time-sensitive
- */
-class MetadataBagTest extends TestCase
-{
- /**
- * @var MetadataBag
- */
- protected $bag;
-
- protected $array = array();
-
- protected function setUp()
- {
- parent::setUp();
- $this->bag = new MetadataBag();
- $this->array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 0);
- $this->bag->initialize($this->array);
- }
-
- protected function tearDown()
- {
- $this->array = array();
- $this->bag = null;
- parent::tearDown();
- }
-
- public function testInitialize()
- {
- $sessionMetadata = array();
-
- $bag1 = new MetadataBag();
- $bag1->initialize($sessionMetadata);
- $this->assertGreaterThanOrEqual(time(), $bag1->getCreated());
- $this->assertEquals($bag1->getCreated(), $bag1->getLastUsed());
-
- sleep(1);
- $bag2 = new MetadataBag();
- $bag2->initialize($sessionMetadata);
- $this->assertEquals($bag1->getCreated(), $bag2->getCreated());
- $this->assertEquals($bag1->getLastUsed(), $bag2->getLastUsed());
- $this->assertEquals($bag2->getCreated(), $bag2->getLastUsed());
-
- sleep(1);
- $bag3 = new MetadataBag();
- $bag3->initialize($sessionMetadata);
- $this->assertEquals($bag1->getCreated(), $bag3->getCreated());
- $this->assertGreaterThan($bag2->getLastUsed(), $bag3->getLastUsed());
- $this->assertNotEquals($bag3->getCreated(), $bag3->getLastUsed());
- }
-
- public function testGetSetName()
- {
- $this->assertEquals('__metadata', $this->bag->getName());
- $this->bag->setName('foo');
- $this->assertEquals('foo', $this->bag->getName());
- }
-
- public function testGetStorageKey()
- {
- $this->assertEquals('_sf2_meta', $this->bag->getStorageKey());
- }
-
- public function testGetLifetime()
- {
- $bag = new MetadataBag();
- $array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 1000);
- $bag->initialize($array);
- $this->assertEquals(1000, $bag->getLifetime());
- }
-
- public function testGetCreated()
- {
- $this->assertEquals(1234567, $this->bag->getCreated());
- }
-
- public function testGetLastUsed()
- {
- $this->assertLessThanOrEqual(time(), $this->bag->getLastUsed());
- }
-
- public function testClear()
- {
- $this->bag->clear();
-
- // the clear method has no side effects, we just want to ensure it doesn't trigger any exceptions
- $this->addToAssertionCount(1);
- }
-
- public function testSkipLastUsedUpdate()
- {
- $bag = new MetadataBag('', 30);
- $timeStamp = time();
-
- $created = $timeStamp - 15;
- $sessionMetadata = array(
- MetadataBag::CREATED => $created,
- MetadataBag::UPDATED => $created,
- MetadataBag::LIFETIME => 1000,
- );
- $bag->initialize($sessionMetadata);
-
- $this->assertEquals($created, $sessionMetadata[MetadataBag::UPDATED]);
- }
-
- public function testDoesNotSkipLastUsedUpdate()
- {
- $bag = new MetadataBag('', 30);
- $timeStamp = time();
-
- $created = $timeStamp - 45;
- $sessionMetadata = array(
- MetadataBag::CREATED => $created,
- MetadataBag::UPDATED => $created,
- MetadataBag::LIFETIME => 1000,
- );
- $bag->initialize($sessionMetadata);
-
- $this->assertEquals($timeStamp, $sessionMetadata[MetadataBag::UPDATED]);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php
deleted file mode 100755
index 82df554..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php
+++ /dev/null
@@ -1,131 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
-use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
-use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
-
-/**
- * Test class for MockArraySessionStorage.
- *
- * @author Drak <drak@zikula.org>
- */
-class MockArraySessionStorageTest extends TestCase
-{
- /**
- * @var MockArraySessionStorage
- */
- private $storage;
-
- /**
- * @var AttributeBag
- */
- private $attributes;
-
- /**
- * @var FlashBag
- */
- private $flashes;
-
- private $data;
-
- protected function setUp()
- {
- $this->attributes = new AttributeBag();
- $this->flashes = new FlashBag();
-
- $this->data = array(
- $this->attributes->getStorageKey() => array('foo' => 'bar'),
- $this->flashes->getStorageKey() => array('notice' => 'hello'),
- );
-
- $this->storage = new MockArraySessionStorage();
- $this->storage->registerBag($this->flashes);
- $this->storage->registerBag($this->attributes);
- $this->storage->setSessionData($this->data);
- }
-
- protected function tearDown()
- {
- $this->data = null;
- $this->flashes = null;
- $this->attributes = null;
- $this->storage = null;
- }
-
- public function testStart()
- {
- $this->assertEquals('', $this->storage->getId());
- $this->storage->start();
- $id = $this->storage->getId();
- $this->assertNotEquals('', $id);
- $this->storage->start();
- $this->assertEquals($id, $this->storage->getId());
- }
-
- public function testRegenerate()
- {
- $this->storage->start();
- $id = $this->storage->getId();
- $this->storage->regenerate();
- $this->assertNotEquals($id, $this->storage->getId());
- $this->assertEquals(array('foo' => 'bar'), $this->storage->getBag('attributes')->all());
- $this->assertEquals(array('notice' => 'hello'), $this->storage->getBag('flashes')->peekAll());
-
- $id = $this->storage->getId();
- $this->storage->regenerate(true);
- $this->assertNotEquals($id, $this->storage->getId());
- $this->assertEquals(array('foo' => 'bar'), $this->storage->getBag('attributes')->all());
- $this->assertEquals(array('notice' => 'hello'), $this->storage->getBag('flashes')->peekAll());
- }
-
- public function testGetId()
- {
- $this->assertEquals('', $this->storage->getId());
- $this->storage->start();
- $this->assertNotEquals('', $this->storage->getId());
- }
-
- public function testClearClearsBags()
- {
- $this->storage->clear();
-
- $this->assertSame(array(), $this->storage->getBag('attributes')->all());
- $this->assertSame(array(), $this->storage->getBag('flashes')->peekAll());
- }
-
- public function testClearStartsSession()
- {
- $this->storage->clear();
-
- $this->assertTrue($this->storage->isStarted());
- }
-
- public function testClearWithNoBagsStartsSession()
- {
- $storage = new MockArraySessionStorage();
-
- $storage->clear();
-
- $this->assertTrue($storage->isStarted());
- }
-
- /**
- * @expectedException \RuntimeException
- */
- public function testUnstartedSave()
- {
- $this->storage->save();
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php
deleted file mode 100755
index 53accd3..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage;
-use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
-use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
-
-/**
- * Test class for MockFileSessionStorage.
- *
- * @author Drak <drak@zikula.org>
- */
-class MockFileSessionStorageTest extends TestCase
-{
- /**
- * @var string
- */
- private $sessionDir;
-
- /**
- * @var MockFileSessionStorage
- */
- protected $storage;
-
- protected function setUp()
- {
- $this->sessionDir = sys_get_temp_dir().'/sf2test';
- $this->storage = $this->getStorage();
- }
-
- protected function tearDown()
- {
- $this->sessionDir = null;
- $this->storage = null;
- array_map('unlink', glob($this->sessionDir.'/*.session'));
- if (is_dir($this->sessionDir)) {
- rmdir($this->sessionDir);
- }
- }
-
- public function testStart()
- {
- $this->assertEquals('', $this->storage->getId());
- $this->assertTrue($this->storage->start());
- $id = $this->storage->getId();
- $this->assertNotEquals('', $this->storage->getId());
- $this->assertTrue($this->storage->start());
- $this->assertEquals($id, $this->storage->getId());
- }
-
- public function testRegenerate()
- {
- $this->storage->start();
- $this->storage->getBag('attributes')->set('regenerate', 1234);
- $this->storage->regenerate();
- $this->assertEquals(1234, $this->storage->getBag('attributes')->get('regenerate'));
- $this->storage->regenerate(true);
- $this->assertEquals(1234, $this->storage->getBag('attributes')->get('regenerate'));
- }
-
- public function testGetId()
- {
- $this->assertEquals('', $this->storage->getId());
- $this->storage->start();
- $this->assertNotEquals('', $this->storage->getId());
- }
-
- public function testSave()
- {
- $this->storage->start();
- $id = $this->storage->getId();
- $this->assertNotEquals('108', $this->storage->getBag('attributes')->get('new'));
- $this->assertFalse($this->storage->getBag('flashes')->has('newkey'));
- $this->storage->getBag('attributes')->set('new', '108');
- $this->storage->getBag('flashes')->set('newkey', 'test');
- $this->storage->save();
-
- $storage = $this->getStorage();
- $storage->setId($id);
- $storage->start();
- $this->assertEquals('108', $storage->getBag('attributes')->get('new'));
- $this->assertTrue($storage->getBag('flashes')->has('newkey'));
- $this->assertEquals(array('test'), $storage->getBag('flashes')->peek('newkey'));
- }
-
- public function testMultipleInstances()
- {
- $storage1 = $this->getStorage();
- $storage1->start();
- $storage1->getBag('attributes')->set('foo', 'bar');
- $storage1->save();
-
- $storage2 = $this->getStorage();
- $storage2->setId($storage1->getId());
- $storage2->start();
- $this->assertEquals('bar', $storage2->getBag('attributes')->get('foo'), 'values persist between instances');
- }
-
- /**
- * @expectedException \RuntimeException
- */
- public function testSaveWithoutStart()
- {
- $storage1 = $this->getStorage();
- $storage1->save();
- }
-
- private function getStorage()
- {
- $storage = new MockFileSessionStorage($this->sessionDir);
- $storage->registerBag(new FlashBag());
- $storage->registerBag(new AttributeBag());
-
- return $storage;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php
deleted file mode 100755
index 8fb8b42..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php
+++ /dev/null
@@ -1,277 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
-use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
-use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
-use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
-
-/**
- * Test class for NativeSessionStorage.
- *
- * @author Drak <drak@zikula.org>
- *
- * These tests require separate processes.
- *
- * @runTestsInSeparateProcesses
- * @preserveGlobalState disabled
- */
-class NativeSessionStorageTest extends TestCase
-{
- private $savePath;
-
- protected function setUp()
- {
- $this->iniSet('session.save_handler', 'files');
- $this->iniSet('session.save_path', $this->savePath = sys_get_temp_dir().'/sf2test');
- if (!is_dir($this->savePath)) {
- mkdir($this->savePath);
- }
- }
-
- protected function tearDown()
- {
- session_write_close();
- array_map('unlink', glob($this->savePath.'/*'));
- if (is_dir($this->savePath)) {
- rmdir($this->savePath);
- }
-
- $this->savePath = null;
- }
-
- /**
- * @return NativeSessionStorage
- */
- protected function getStorage(array $options = array())
- {
- $storage = new NativeSessionStorage($options);
- $storage->registerBag(new AttributeBag());
-
- return $storage;
- }
-
- public function testBag()
- {
- $storage = $this->getStorage();
- $bag = new FlashBag();
- $storage->registerBag($bag);
- $this->assertSame($bag, $storage->getBag($bag->getName()));
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testRegisterBagException()
- {
- $storage = $this->getStorage();
- $storage->getBag('non_existing');
- }
-
- /**
- * @expectedException \LogicException
- */
- public function testRegisterBagForAStartedSessionThrowsException()
- {
- $storage = $this->getStorage();
- $storage->start();
- $storage->registerBag(new AttributeBag());
- }
-
- public function testGetId()
- {
- $storage = $this->getStorage();
- $this->assertSame('', $storage->getId(), 'Empty ID before starting session');
-
- $storage->start();
- $id = $storage->getId();
- $this->assertInternalType('string', $id);
- $this->assertNotSame('', $id);
-
- $storage->save();
- $this->assertSame($id, $storage->getId(), 'ID stays after saving session');
- }
-
- public function testRegenerate()
- {
- $storage = $this->getStorage();
- $storage->start();
- $id = $storage->getId();
- $storage->getBag('attributes')->set('lucky', 7);
- $storage->regenerate();
- $this->assertNotEquals($id, $storage->getId());
- $this->assertEquals(7, $storage->getBag('attributes')->get('lucky'));
- }
-
- public function testRegenerateDestroy()
- {
- $storage = $this->getStorage();
- $storage->start();
- $id = $storage->getId();
- $storage->getBag('attributes')->set('legs', 11);
- $storage->regenerate(true);
- $this->assertNotEquals($id, $storage->getId());
- $this->assertEquals(11, $storage->getBag('attributes')->get('legs'));
- }
-
- public function testSessionGlobalIsUpToDateAfterIdRegeneration()
- {
- $storage = $this->getStorage();
- $storage->start();
- $storage->getBag('attributes')->set('lucky', 7);
- $storage->regenerate();
- $storage->getBag('attributes')->set('lucky', 42);
-
- $this->assertEquals(42, $_SESSION['_sf2_attributes']['lucky']);
- }
-
- public function testRegenerationFailureDoesNotFlagStorageAsStarted()
- {
- $storage = $this->getStorage();
- $this->assertFalse($storage->regenerate());
- $this->assertFalse($storage->isStarted());
- }
-
- public function testDefaultSessionCacheLimiter()
- {
- $this->iniSet('session.cache_limiter', 'nocache');
-
- $storage = new NativeSessionStorage();
- $this->assertEquals('', ini_get('session.cache_limiter'));
- }
-
- public function testExplicitSessionCacheLimiter()
- {
- $this->iniSet('session.cache_limiter', 'nocache');
-
- $storage = new NativeSessionStorage(array('cache_limiter' => 'public'));
- $this->assertEquals('public', ini_get('session.cache_limiter'));
- }
-
- public function testCookieOptions()
- {
- $options = array(
- 'cookie_lifetime' => 123456,
- 'cookie_path' => '/my/cookie/path',
- 'cookie_domain' => 'symfony.example.com',
- 'cookie_secure' => true,
- 'cookie_httponly' => false,
- );
-
- $this->getStorage($options);
- $temp = session_get_cookie_params();
- $gco = array();
-
- foreach ($temp as $key => $value) {
- $gco['cookie_'.$key] = $value;
- }
-
- $this->assertEquals($options, $gco);
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testSetSaveHandlerException()
- {
- $storage = $this->getStorage();
- $storage->setSaveHandler(new \stdClass());
- }
-
- public function testSetSaveHandler()
- {
- $this->iniSet('session.save_handler', 'files');
- $storage = $this->getStorage();
- $storage->setSaveHandler();
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler());
- $storage->setSaveHandler(null);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler());
- $storage->setSaveHandler(new SessionHandlerProxy(new NativeFileSessionHandler()));
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler());
- $storage->setSaveHandler(new NativeFileSessionHandler());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler());
- $storage->setSaveHandler(new SessionHandlerProxy(new NullSessionHandler()));
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler());
- $storage->setSaveHandler(new NullSessionHandler());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler());
- }
-
- /**
- * @expectedException \RuntimeException
- */
- public function testStarted()
- {
- $storage = $this->getStorage();
-
- $this->assertFalse($storage->getSaveHandler()->isActive());
- $this->assertFalse($storage->isStarted());
-
- session_start();
- $this->assertTrue(isset($_SESSION));
- $this->assertTrue($storage->getSaveHandler()->isActive());
-
- // PHP session might have started, but the storage driver has not, so false is correct here
- $this->assertFalse($storage->isStarted());
-
- $key = $storage->getMetadataBag()->getStorageKey();
- $this->assertArrayNotHasKey($key, $_SESSION);
- $storage->start();
- }
-
- public function testRestart()
- {
- $storage = $this->getStorage();
- $storage->start();
- $id = $storage->getId();
- $storage->getBag('attributes')->set('lucky', 7);
- $storage->save();
- $storage->start();
- $this->assertSame($id, $storage->getId(), 'Same session ID after restarting');
- $this->assertSame(7, $storage->getBag('attributes')->get('lucky'), 'Data still available');
- }
-
- public function testCanCreateNativeSessionStorageWhenSessionAlreadyStarted()
- {
- session_start();
- $this->getStorage();
-
- // Assert no exception has been thrown by `getStorage()`
- $this->addToAssertionCount(1);
- }
-
- public function testSetSessionOptionsOnceSessionStartedIsIgnored()
- {
- session_start();
- $this->getStorage(array(
- 'name' => 'something-else',
- ));
-
- // Assert no exception has been thrown by `getStorage()`
- $this->addToAssertionCount(1);
- }
-
- public function testGetBagsOnceSessionStartedIsIgnored()
- {
- session_start();
- $bag = new AttributeBag();
- $bag->setName('flashes');
-
- $storage = $this->getStorage();
- $storage->registerBag($bag);
-
- $this->assertEquals($storage->getBag('flashes'), $bag);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
deleted file mode 100755
index 958dc0b..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage;
-use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
-
-/**
- * Test class for PhpSessionStorage.
- *
- * @author Drak <drak@zikula.org>
- *
- * These tests require separate processes.
- *
- * @runTestsInSeparateProcesses
- * @preserveGlobalState disabled
- */
-class PhpBridgeSessionStorageTest extends TestCase
-{
- private $savePath;
-
- protected function setUp()
- {
- $this->iniSet('session.save_handler', 'files');
- $this->iniSet('session.save_path', $this->savePath = sys_get_temp_dir().'/sf2test');
- if (!is_dir($this->savePath)) {
- mkdir($this->savePath);
- }
- }
-
- protected function tearDown()
- {
- session_write_close();
- array_map('unlink', glob($this->savePath.'/*'));
- if (is_dir($this->savePath)) {
- rmdir($this->savePath);
- }
-
- $this->savePath = null;
- }
-
- /**
- * @return PhpBridgeSessionStorage
- */
- protected function getStorage()
- {
- $storage = new PhpBridgeSessionStorage();
- $storage->registerBag(new AttributeBag());
-
- return $storage;
- }
-
- public function testPhpSession()
- {
- $storage = $this->getStorage();
-
- $this->assertFalse($storage->getSaveHandler()->isActive());
- $this->assertFalse($storage->isStarted());
-
- session_start();
- $this->assertTrue(isset($_SESSION));
- // in PHP 5.4 we can reliably detect a session started
- $this->assertTrue($storage->getSaveHandler()->isActive());
- // PHP session might have started, but the storage driver has not, so false is correct here
- $this->assertFalse($storage->isStarted());
-
- $key = $storage->getMetadataBag()->getStorageKey();
- $this->assertArrayNotHasKey($key, $_SESSION);
- $storage->start();
- $this->assertArrayHasKey($key, $_SESSION);
- }
-
- public function testClear()
- {
- $storage = $this->getStorage();
- session_start();
- $_SESSION['drak'] = 'loves symfony';
- $storage->getBag('attributes')->set('symfony', 'greatness');
- $key = $storage->getBag('attributes')->getStorageKey();
- $this->assertEquals($_SESSION[$key], array('symfony' => 'greatness'));
- $this->assertEquals($_SESSION['drak'], 'loves symfony');
- $storage->clear();
- $this->assertEquals($_SESSION[$key], array());
- $this->assertEquals($_SESSION['drak'], 'loves symfony');
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
deleted file mode 100755
index cbb291f..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
-use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
-
-/**
- * Test class for AbstractProxy.
- *
- * @author Drak <drak@zikula.org>
- */
-class AbstractProxyTest extends TestCase
-{
- /**
- * @var AbstractProxy
- */
- protected $proxy;
-
- protected function setUp()
- {
- $this->proxy = $this->getMockForAbstractClass(AbstractProxy::class);
- }
-
- protected function tearDown()
- {
- $this->proxy = null;
- }
-
- public function testGetSaveHandlerName()
- {
- $this->assertNull($this->proxy->getSaveHandlerName());
- }
-
- public function testIsSessionHandlerInterface()
- {
- $this->assertFalse($this->proxy->isSessionHandlerInterface());
- $sh = new SessionHandlerProxy(new \SessionHandler());
- $this->assertTrue($sh->isSessionHandlerInterface());
- }
-
- public function testIsWrapper()
- {
- $this->assertFalse($this->proxy->isWrapper());
- }
-
- /**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- */
- public function testIsActive()
- {
- $this->assertFalse($this->proxy->isActive());
- session_start();
- $this->assertTrue($this->proxy->isActive());
- }
-
- /**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- */
- public function testName()
- {
- $this->assertEquals(session_name(), $this->proxy->getName());
- $this->proxy->setName('foo');
- $this->assertEquals('foo', $this->proxy->getName());
- $this->assertEquals(session_name(), $this->proxy->getName());
- }
-
- /**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @expectedException \LogicException
- */
- public function testNameException()
- {
- session_start();
- $this->proxy->setName('foo');
- }
-
- /**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- */
- public function testId()
- {
- $this->assertEquals(session_id(), $this->proxy->getId());
- $this->proxy->setId('foo');
- $this->assertEquals('foo', $this->proxy->getId());
- $this->assertEquals(session_id(), $this->proxy->getId());
- }
-
- /**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @expectedException \LogicException
- */
- public function testIdException()
- {
- session_start();
- $this->proxy->setId('foo');
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/NativeProxyTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/NativeProxyTest.php
deleted file mode 100755
index ed4fee6..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/NativeProxyTest.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy;
-
-/**
- * Test class for NativeProxy.
- *
- * @group legacy
- *
- * @author Drak <drak@zikula.org>
- */
-class NativeProxyTest extends TestCase
-{
- public function testIsWrapper()
- {
- $proxy = new NativeProxy();
- $this->assertFalse($proxy->isWrapper());
- }
-
- public function testGetSaveHandlerName()
- {
- $name = ini_get('session.save_handler');
- $proxy = new NativeProxy();
- $this->assertEquals($name, $proxy->getSaveHandlerName());
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
deleted file mode 100755
index 6828253..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
-
-/**
- * Tests for SessionHandlerProxy class.
- *
- * @author Drak <drak@zikula.org>
- *
- * @runTestsInSeparateProcesses
- * @preserveGlobalState disabled
- */
-class SessionHandlerProxyTest extends TestCase
-{
- /**
- * @var \PHPUnit_Framework_MockObject_Matcher
- */
- private $mock;
-
- /**
- * @var SessionHandlerProxy
- */
- private $proxy;
-
- protected function setUp()
- {
- $this->mock = $this->getMockBuilder('SessionHandlerInterface')->getMock();
- $this->proxy = new SessionHandlerProxy($this->mock);
- }
-
- protected function tearDown()
- {
- $this->mock = null;
- $this->proxy = null;
- }
-
- public function testOpenTrue()
- {
- $this->mock->expects($this->once())
- ->method('open')
- ->will($this->returnValue(true));
-
- $this->assertFalse($this->proxy->isActive());
- $this->proxy->open('name', 'id');
- $this->assertFalse($this->proxy->isActive());
- }
-
- public function testOpenFalse()
- {
- $this->mock->expects($this->once())
- ->method('open')
- ->will($this->returnValue(false));
-
- $this->assertFalse($this->proxy->isActive());
- $this->proxy->open('name', 'id');
- $this->assertFalse($this->proxy->isActive());
- }
-
- public function testClose()
- {
- $this->mock->expects($this->once())
- ->method('close')
- ->will($this->returnValue(true));
-
- $this->assertFalse($this->proxy->isActive());
- $this->proxy->close();
- $this->assertFalse($this->proxy->isActive());
- }
-
- public function testCloseFalse()
- {
- $this->mock->expects($this->once())
- ->method('close')
- ->will($this->returnValue(false));
-
- $this->assertFalse($this->proxy->isActive());
- $this->proxy->close();
- $this->assertFalse($this->proxy->isActive());
- }
-
- public function testRead()
- {
- $this->mock->expects($this->once())
- ->method('read');
-
- $this->proxy->read('id');
- }
-
- public function testWrite()
- {
- $this->mock->expects($this->once())
- ->method('write');
-
- $this->proxy->write('id', 'data');
- }
-
- public function testDestroy()
- {
- $this->mock->expects($this->once())
- ->method('destroy');
-
- $this->proxy->destroy('id');
- }
-
- public function testGc()
- {
- $this->mock->expects($this->once())
- ->method('gc');
-
- $this->proxy->gc(86400);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php b/assets/php/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php
deleted file mode 100755
index c2ded99..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\StreamedResponse;
-
-class StreamedResponseTest extends TestCase
-{
- public function testConstructor()
- {
- $response = new StreamedResponse(function () { echo 'foo'; }, 404, array('Content-Type' => 'text/plain'));
-
- $this->assertEquals(404, $response->getStatusCode());
- $this->assertEquals('text/plain', $response->headers->get('Content-Type'));
- }
-
- public function testPrepareWith11Protocol()
- {
- $response = new StreamedResponse(function () { echo 'foo'; });
- $request = Request::create('/');
- $request->server->set('SERVER_PROTOCOL', 'HTTP/1.1');
-
- $response->prepare($request);
-
- $this->assertEquals('1.1', $response->getProtocolVersion());
- $this->assertNotEquals('chunked', $response->headers->get('Transfer-Encoding'), 'Apache assumes responses with a Transfer-Encoding header set to chunked to already be encoded.');
- }
-
- public function testPrepareWith10Protocol()
- {
- $response = new StreamedResponse(function () { echo 'foo'; });
- $request = Request::create('/');
- $request->server->set('SERVER_PROTOCOL', 'HTTP/1.0');
-
- $response->prepare($request);
-
- $this->assertEquals('1.0', $response->getProtocolVersion());
- $this->assertNull($response->headers->get('Transfer-Encoding'));
- }
-
- public function testPrepareWithHeadRequest()
- {
- $response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Content-Length' => '123'));
- $request = Request::create('/', 'HEAD');
-
- $response->prepare($request);
-
- $this->assertSame('123', $response->headers->get('Content-Length'));
- }
-
- public function testPrepareWithCacheHeaders()
- {
- $response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Cache-Control' => 'max-age=600, public'));
- $request = Request::create('/', 'GET');
-
- $response->prepare($request);
- $this->assertEquals('max-age=600, public', $response->headers->get('Cache-Control'));
- }
-
- public function testSendContent()
- {
- $called = 0;
-
- $response = new StreamedResponse(function () use (&$called) { ++$called; });
-
- $response->sendContent();
- $this->assertEquals(1, $called);
-
- $response->sendContent();
- $this->assertEquals(1, $called);
- }
-
- /**
- * @expectedException \LogicException
- */
- public function testSendContentWithNonCallable()
- {
- $response = new StreamedResponse(null);
- $response->sendContent();
- }
-
- /**
- * @expectedException \LogicException
- */
- public function testSetContent()
- {
- $response = new StreamedResponse(function () { echo 'foo'; });
- $response->setContent('foo');
- }
-
- public function testGetContent()
- {
- $response = new StreamedResponse(function () { echo 'foo'; });
- $this->assertFalse($response->getContent());
- }
-
- public function testCreate()
- {
- $response = StreamedResponse::create(function () {}, 204);
-
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response);
- $this->assertEquals(204, $response->getStatusCode());
- }
-
- public function testReturnThis()
- {
- $response = new StreamedResponse(function () {});
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendContent());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendContent());
-
- $response = new StreamedResponse(function () {});
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders());
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders());
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/schema/http-status-codes.rng b/assets/php/vendor/symfony/http-foundation/Tests/schema/http-status-codes.rng
deleted file mode 100755
index 73708ca..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/schema/http-status-codes.rng
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version='1.0'?>
-<grammar xmlns="http://relaxng.org/ns/structure/1.0"
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
- ns="http://www.iana.org/assignments">
-
- <include href="iana-registry.rng"/>
-
- <start>
- <element name="registry">
- <ref name="registryMeta"/>
- <element name="registry">
- <ref name="registryMeta"/>
- <zeroOrMore>
- <element name="record">
- <optional>
- <attribute name="date"><ref name="genericDate"/></attribute>
- </optional>
- <optional>
- <attribute name="updated"><ref name="genericDate"/></attribute>
- </optional>
- <element name="value"><ref name="genericRange"/></element>
- <element name="description"><text/></element>
- <ref name="references"/>
- </element>
- </zeroOrMore>
- </element>
- <ref name="people"/>
- </element>
- </start>
-
-</grammar>
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/schema/iana-registry.rng b/assets/php/vendor/symfony/http-foundation/Tests/schema/iana-registry.rng
deleted file mode 100755
index b9c3ca9..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/schema/iana-registry.rng
+++ /dev/null
@@ -1,198 +0,0 @@
-<?xml version='1.0'?>
-<grammar xmlns="http://relaxng.org/ns/structure/1.0"
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
- ns="http://www.iana.org/assignments">
-
- <define name="registryMeta">
- <interleave>
- <attribute name="id"><data type="ID"/></attribute>
- <optional><element name="title"><ref name="text_with_references"/></element></optional>
- <optional><element name="created"><ref name="genericDate"/></element></optional>
- <optional><element name="updated"><data type="date"/></element></optional>
- <optional><element name="registration_rule"><ref
- name="text_with_references"/></element></optional>
- <optional><element name="expert"><text/></element></optional>
- <optional><element name="description"><ref name="text_with_references"/></element></optional>
- <zeroOrMore><element name="note"><ref name="text_with_references"/></element></zeroOrMore>
- <ref name="references"/>
- <optional><element name="hide"><empty/></element></optional>
- <zeroOrMore><element name="category"><text/></element></zeroOrMore>
- <zeroOrMore><ref name="range"/></zeroOrMore>
- <optional><ref name="file"/></optional>
- </interleave>
- </define>
-
- <define name="range">
- <element name="range">
- <interleave>
- <element name="value"><text/></element>
- <optional><element name="hex"><text/></element></optional>
- <element name="registration_rule"><ref name="text_with_references"/></element>
- <optional><element name="note"><ref name="text_with_references"/></element></optional>
- <optional><ref name="xref"/></optional>
- </interleave>
- </element>
- </define>
-
- <define name="people">
- <element name="people">
- <zeroOrMore>
- <element name="person">
- <attribute name="id"><data type="ID"/></attribute>
- <optional><element name="name"><text/></element></optional>
- <optional><element name="org"><text/></element></optional>
- <zeroOrMore><element name="uri"><data type="anyURI"/></element></zeroOrMore>
- <optional><element name="updated"><ref name="genericDate"/></element></optional>
- </element>
- </zeroOrMore>
- </element>
- </define>
-
- <define name="xref">
- <element name="xref">
- <optional>
- <attribute name="lastupdated"><ref name="genericDate"/></attribute>
- </optional>
- <choice>
- <group>
- <attribute name="type"><value>uri</value></attribute>
- <attribute name="data"><data type="anyURI"/></attribute>
- </group>
- <group>
- <attribute name="type"><value>rfc</value></attribute>
- <attribute name="data">
- <data type="string">
- <param name="pattern">(rfc|bcp|std)\d+</param>
- </data>
- </attribute>
- </group>
- <group>
- <attribute name="type"><value>rfc-errata</value></attribute>
- <attribute name="data"><data type="positiveInteger"/></attribute>
- </group>
- <group>
- <attribute name="type"><value>draft</value></attribute>
- <attribute name="data">
- <data type="string">
- <param name="pattern">(draft|RFC)(-[a-zA-Z0-9]+)+</param>
- </data>
- </attribute>
- </group>
- <group>
- <attribute name="type"><value>registry</value></attribute>
- <attribute name="data"><data type="NCName"/></attribute>
- </group>
- <group>
- <attribute name="type"><value>person</value></attribute>
- <attribute name="data"><data type="NCName"/></attribute>
- </group>
- <group>
- <attribute name="type"><value>text</value></attribute>
- </group>
- <group>
- <attribute name="type"><value>note</value></attribute>
- <attribute name="data"><data type="positiveInteger"/></attribute>
- </group>
- <group>
- <attribute name="type"><value>unicode</value></attribute>
- <attribute name="data">
- <data type="string">
- <param name="pattern">ucd\d+\.\d+\.\d+</param>
- </data>
- </attribute>
- </group>
- </choice>
- <text/>
- </element>
- </define>
-
- <define name="references">
- <zeroOrMore>
- <ref name="xref"/>
- </zeroOrMore>
- </define>
-
- <define name="text_with_references">
- <interleave>
- <zeroOrMore>
- <text/>
- <optional><ref name="xref"/></optional>
- </zeroOrMore>
- </interleave>
- </define>
-
- <define name="richText">
- <zeroOrMore>
- <choice>
- <interleave>
- <ref name="text_with_references"/>
- <optional><element name="br"><empty/></element></optional>
- </interleave>
- <element name="paragraph">
- <interleave>
- <ref name="text_with_references"/>
- <optional><element name="br"><empty/></element></optional>
- </interleave>
- </element>
- <element name="artwork"><text/></element>
- </choice>
- </zeroOrMore>
- </define>
-
- <define name="genericRange">
- <data type="string">
- <param name="pattern">(\d+|0x[\da-fA-F]+)(\s*-\s*(\d+|0x[\da-fA-F]+))?</param>
- </data>
- </define>
-
- <define name="genericDate">
- <choice>
- <data type="date"/>
- <data type="gYearMonth"/>
- </choice>
- </define>
-
- <define name="hex32">
- <data type="string">
- <param name="pattern">0x[0-9]{8}</param>
- </data>
- </define>
-
- <define name="binary">
- <data type="string">
- <param name="pattern">[0-1]+</param>
- </data>
- </define>
-
- <define name="footnotes">
- <zeroOrMore>
- <element name="footnote">
- <attribute name="anchor"><data type="positiveInteger"/></attribute>
- <interleave>
- <zeroOrMore>
- <text/>
- <optional><ref name="xref"/></optional>
- </zeroOrMore>
- </interleave>
- </element>
- </zeroOrMore>
- </define>
-
- <define name="file">
- <element name="file">
- <attribute name="type">
- <choice>
- <value>legacy</value>
- <value>mib</value>
- <value>template</value>
- <value>json</value>
- </choice>
- </attribute>
- <optional>
- <attribute name="name"/>
- </optional>
- <data type="anyURI"/>
- </element>
- </define>
-
-</grammar>