[HttpFoundation][bugfix] should always be initialized

This commit is contained in:
Dawid Nowak 2017-03-24 04:07:57 +01:00 committed by Fabien Potencier
parent 80af0838f5
commit d984c73e66
2 changed files with 25 additions and 1 deletions

View File

@ -60,7 +60,7 @@ class MockArraySessionStorage implements SessionStorageInterface
/**
* @var array
*/
protected $bags;
protected $bags = array();
/**
* Constructor.

View File

@ -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
*/