File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
src/Symfony/Component/HttpFoundation Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -260,6 +260,10 @@ public function clear()
260
260
*/
261
261
public function registerBag (SessionBagInterface $ bag )
262
262
{
263
+ if ($ this ->started ) {
264
+ throw new \LogicException ('Cannot register a bag when the session is already started. ' );
265
+ }
266
+
263
267
$ this ->bags [$ bag ->getName ()] = $ bag ;
264
268
}
265
269
Original file line number Diff line number Diff line change @@ -83,6 +83,16 @@ public function testRegisterBagException()
83
83
$ storage ->getBag ('non_existing ' );
84
84
}
85
85
86
+ /**
87
+ * @expectedException \LogicException
88
+ */
89
+ public function testRegisterBagForAStartedSessionThrowsException ()
90
+ {
91
+ $ storage = $ this ->getStorage ();
92
+ $ storage ->start ();
93
+ $ storage ->registerBag (new AttributeBag ());
94
+ }
95
+
86
96
public function testGetId ()
87
97
{
88
98
$ storage = $ this ->getStorage ();
You can’t perform that action at this time.
0 commit comments