summaryrefslogtreecommitdiff
path: root/vendor/symfony/http-foundation/Tests/Session/SessionTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/http-foundation/Tests/Session/SessionTest.php')
-rw-r--r--vendor/symfony/http-foundation/Tests/Session/SessionTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php
index afa00fc7c3..acb129984e 100644
--- a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php
@@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Session;
+use Symfony\Component\HttpFoundation\Session\SessionBagProxy;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
/**
@@ -260,4 +261,28 @@ class SessionTest extends TestCase
$flash->get('hello');
$this->assertTrue($this->session->isEmpty());
}
+
+ public function testGetBagWithBagImplementingGetBag()
+ {
+ $bag = new AttributeBag();
+ $bag->setName('foo');
+
+ $storage = new MockArraySessionStorage();
+ $storage->registerBag($bag);
+
+ $this->assertSame($bag, (new Session($storage))->getBag('foo'));
+ }
+
+ public function testGetBagWithBagNotImplementingGetBag()
+ {
+ $data = [];
+
+ $bag = new AttributeBag();
+ $bag->setName('foo');
+
+ $storage = new MockArraySessionStorage();
+ $storage->registerBag(new SessionBagProxy($bag, $data, $usageIndex));
+
+ $this->assertSame($bag, (new Session($storage))->getBag('foo'));
+ }
}