bug #22138 [HttpFoundation][bugfix] $bags should always be initialized (MacDada)
This PR was squashed before being merged into the 2.7 branch (closes #22138).
Discussion
----------
[HttpFoundation][bugfix] $bags should always be initialized
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21990
| License | MIT
Commits
-------
d984c73e66
[HttpFoundation][bugfix] should always be initialized
This commit is contained in:
commit
2606c48f69
@ -60,7 +60,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $bags;
|
||||
protected $bags = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -97,6 +97,30 @@ class MockArraySessionStorageTest extends TestCase
|
||||
$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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user