diff options
author | marvin-borner@live.com | 2018-04-16 21:09:05 +0200 |
---|---|---|
committer | marvin-borner@live.com | 2018-04-16 21:09:05 +0200 |
commit | cf14306c2b3f82a81f8d56669a71633b4d4b5fce (patch) | |
tree | 86700651aa180026e89a66064b0364b1e4346f3f /assets/php/vendor/symfony/http-foundation/Tests/Session | |
parent | 619b01b3615458c4ed78bfaeabb6b1a47cc8ad8b (diff) |
Main merge to user management system - files are now at /main/public/
Diffstat (limited to 'assets/php/vendor/symfony/http-foundation/Tests/Session')
36 files changed, 0 insertions, 3823 deletions
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); - } -} |