/** * @test */ public function getValueReturnsTheSetValue() { $cookie = new Cookie('foo', 'bar'); $this->assertEquals('bar', $cookie->getValue()); $cookie = new Cookie('foo', 'bar'); $cookie->setValue('baz'); $this->assertEquals('baz', $cookie->getValue()); $cookie = new Cookie('foo', true); $this->assertSame(true, $cookie->getValue()); $uri = new Uri('http://localhost'); $cookie = new Cookie('foo', $uri); $this->assertSame($uri, $cookie->getValue()); }
/** * Generates and propagates a new session ID and transfers all existing data * to the new session. * * @return string The new session ID * @throws Exception\SessionNotStartedException * @throws Exception\OperationNotSupportedException * @api */ public function renewId() { if ($this->started !== true) { throw new Exception\SessionNotStartedException('Tried to renew the session identifier, but the session has not been started yet.', 1351182429); } if ($this->remote === true) { throw new Exception\OperationNotSupportedException(sprintf('Tried to renew the session identifier on a remote session (%s).', $this->sessionIdentifier), 1354034230); } $this->removeSessionMetaDataCacheEntry($this->sessionIdentifier); $this->sessionIdentifier = Algorithms::generateRandomString(32); $this->writeSessionMetaDataCacheEntry(); $this->sessionCookie->setValue($this->sessionIdentifier); return $this->sessionIdentifier; }