Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
161
vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
vendored
Normal file
161
vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
vendored
Normal file
|
@ -0,0 +1,161 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
157
vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php
vendored
Normal file
157
vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php
vendored
Normal file
|
@ -0,0 +1,157 @@
|
|||
<?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 testAdd()
|
||||
{
|
||||
$tab = array('bar' => 'baz');
|
||||
$this->bag->add('string_message', 'lorem');
|
||||
$this->bag->add('object_message', new \stdClass());
|
||||
$this->bag->add('array_message', $tab);
|
||||
|
||||
$this->assertEquals(array('lorem'), $this->bag->get('string_message'));
|
||||
$this->assertEquals(array(new \stdClass()), $this->bag->get('object_message'));
|
||||
$this->assertEquals(array($tab), $this->bag->get('array_message'));
|
||||
}
|
||||
|
||||
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 testSetAll()
|
||||
{
|
||||
$this->bag->add('one_flash', 'Foo');
|
||||
$this->bag->add('another_flash', 'Bar');
|
||||
$this->assertTrue($this->bag->has('one_flash'));
|
||||
$this->assertTrue($this->bag->has('another_flash'));
|
||||
$this->bag->setAll(array('unique_flash' => 'FooBar'));
|
||||
$this->assertFalse($this->bag->has('one_flash'));
|
||||
$this->assertFalse($this->bag->has('another_flash'));
|
||||
$this->assertSame(array('unique_flash' => 'FooBar'), $this->bag->all());
|
||||
$this->assertSame(array(), $this->bag->all());
|
||||
}
|
||||
|
||||
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()
|
||||
);
|
||||
}
|
||||
}
|
Reference in a new issue