Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ public function clear()
*/
public function registerBag(SessionBagInterface $bag)
{
if ($this->started) {
throw new \LogicException('Cannot register a bag when the session is already started.');
}

$this->bags[$bag->getName()] = $bag;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ public function testRegisterBagException()
$storage->getBag('non_existing');
}

/**
* @expectedException \LogicException
*/
public function testRegisterBagForAStartedSessionThrowsException()
{
$storage = $this->getStorage();
$storage->start();
$storage->registerBag(new AttributeBag());
}

public function testGetId()
{
$storage = $this->getStorage();
Expand Down