Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
@@ -26,13 +26,13 @@ class FlashBagTest extends TestCase
*/
private $bag;
protected $array = array();
protected $array = [];
protected function setUp()
{
parent::setUp();
$this->bag = new FlashBag();
$this->array = array('notice' => array('A previous flash message'));
$this->array = ['notice' => ['A previous flash message']];
$this->bag->initialize($this->array);
}
@@ -47,14 +47,14 @@ class FlashBagTest extends TestCase
$bag = new FlashBag();
$bag->initialize($this->array);
$this->assertEquals($this->array, $bag->peekAll());
$array = array('should' => array('change'));
$array = ['should' => ['change']];
$bag->initialize($array);
$this->assertEquals($array, $bag->peekAll());
}
public function testGetStorageKey()
{
$this->assertEquals('_sf2_flashes', $this->bag->getStorageKey());
$this->assertEquals('_symfony_flashes', $this->bag->getStorageKey());
$attributeBag = new FlashBag('test');
$this->assertEquals('test', $attributeBag->getStorageKey());
}
@@ -68,49 +68,49 @@ class FlashBagTest extends TestCase
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'));
$this->assertEquals([], $this->bag->peek('non_existing'));
$this->assertEquals(['default'], $this->bag->peek('not_existing', ['default']));
$this->assertEquals(['A previous flash message'], $this->bag->peek('notice'));
$this->assertEquals(['A previous flash message'], $this->bag->peek('notice'));
}
public function testAdd()
{
$tab = array('bar' => 'baz');
$tab = ['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'));
$this->assertEquals(['lorem'], $this->bag->get('string_message'));
$this->assertEquals([new \stdClass()], $this->bag->get('object_message'));
$this->assertEquals([$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'));
$this->assertEquals([], $this->bag->get('non_existing'));
$this->assertEquals(['default'], $this->bag->get('not_existing', ['default']));
$this->assertEquals(['A previous flash message'], $this->bag->get('notice'));
$this->assertEquals([], $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([
'notice' => ['Foo'],
'error' => ['Bar'], ], $this->bag->all()
);
$this->assertEquals(array(), $this->bag->all());
$this->assertEquals([], $this->bag->all());
}
public function testSet()
{
$this->bag->set('notice', 'Foo');
$this->bag->set('notice', 'Bar');
$this->assertEquals(array('Bar'), $this->bag->peek('notice'));
$this->assertEquals(['Bar'], $this->bag->peek('notice'));
}
public function testHas()
@@ -121,7 +121,7 @@ class FlashBagTest extends TestCase
public function testKeys()
{
$this->assertEquals(array('notice'), $this->bag->keys());
$this->assertEquals(['notice'], $this->bag->keys());
}
public function testSetAll()
@@ -130,48 +130,28 @@ class FlashBagTest extends TestCase
$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->bag->setAll(['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());
$this->assertSame(['unique_flash' => 'FooBar'], $this->bag->all());
$this->assertSame([], $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->assertEquals([
'notice' => ['Foo'],
'error' => ['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()
$this->assertEquals([
'notice' => ['Foo'],
'error' => ['Bar'],
], $this->bag->peekAll()
);
}
/**
* @group legacy
*/
public function testLegacyGetIterator()
{
$flashes = array('hello' => 'world', 'beep' => 'boop', 'notice' => 'nope');
foreach ($flashes as $key => $val) {
$this->bag->set($key, $val);
}
$i = 0;
foreach ($this->bag as $key => $val) {
$this->assertEquals(array($flashes[$key]), $val);
++$i;
}
$this->assertEquals(\count($flashes), $i);
$this->assertCount(0, $this->bag->all());
}
}