public function testMarkingOneSessionObjectImmutableShouldMarkOtherInstancesImmutable() { $this->storage->foo = 'bar'; $storage = new SessionArrayStorage(); $this->assertEquals('bar', $storage['foo']); $this->storage->markImmutable(); $this->assertTrue($storage->isImmutable(), var_export($_SESSION, 1)); }
/** * Retrieve the CAPTCHA code * *@param $key * * @return mixed|null */ protected function getExpectedCode($key) { $arrayZendSession = new SessionArrayStorage(); if ($this->session->has($key)) { $sessionKey = $this->session->get($key); $this->session->remove($key); $captchaSession = $arrayZendSession->offsetGet($sessionKey); $arrayZendSession->offsetUnset($sessionKey); if ($captchaSession instanceof ArrayObject) { $word = $captchaSession->offsetGet('word'); $captchaSession->offsetUnset('word'); return $word; } } return null; }
/** * @runInSeparateProcess */ public function testExpirationHops() { // since we cannot explicitly test reinitalizing the session // we will act in how session manager would in this case. $storage = new SessionArrayStorage(); $manager = new SessionManager(null, $storage); $manager->start(); $container = new Container('test'); $container->foo = 'bar'; $container->setExpirationHops(1); $copy = $_SESSION; $_SESSION = null; $storage->init($copy); $this->assertEquals('bar', $container->foo); $copy = $_SESSION; $_SESSION = null; $storage->init($copy); $this->assertNull($container->foo); }