Skip to content

Commit d984c73

Browse files
MacDadafabpot
authored andcommitted
[HttpFoundation][bugfix] should always be initialized
1 parent 80af083 commit d984c73

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class MockArraySessionStorage implements SessionStorageInterface
6060
/**
6161
* @var array
6262
*/
63-
protected $bags;
63+
protected $bags = array();
6464

6565
/**
6666
* Constructor.

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,30 @@ public function testGetId()
9797
$this->assertNotEquals('', $this->storage->getId());
9898
}
9999

100+
public function testClearClearsBags()
101+
{
102+
$this->storage->clear();
103+
104+
$this->assertSame(array(), $this->storage->getBag('attributes')->all());
105+
$this->assertSame(array(), $this->storage->getBag('flashes')->peekAll());
106+
}
107+
108+
public function testClearStartsSession()
109+
{
110+
$this->storage->clear();
111+
112+
$this->assertTrue($this->storage->isStarted());
113+
}
114+
115+
public function testClearWithNoBagsStartsSession()
116+
{
117+
$storage = new MockArraySessionStorage();
118+
119+
$storage->clear();
120+
121+
$this->assertTrue($storage->isStarted());
122+
}
123+
100124
/**
101125
* @expectedException \RuntimeException
102126
*/

0 commit comments

Comments
 (0)