public function testGetQueuedCookies() { $request = new Request(); $this->cookieJar = new CookieJar($request); $this->cookieJar->set('cookie1', 'value1'); $this->cookieJar->set('cookie2', 'value2'); $this->assertCount(2, $this->cookieJar->getQueuedCookies()); }
/** * {@inheritdoc} */ public function write($user, $remember = false) { if ($token = $this->getToken()) { $this->connection->delete($this->config['table'], ['id' => sha1($token)]); } $id = $this->random->generateString(64); $this->cookie->set($this->config['cookie']['name'], $id, $this->config['cookie']['lifetime'] + time()); $this->createTable(); $this->connection->insert($this->config['table'], ['id' => sha1($id), 'user_id' => $user, 'access' => date('Y-m-d H:i:s'), 'status' => $remember ? self::STATUS_REMEMBERED : self::STATUS_ACTIVE, 'data' => json_encode(['ip' => $this->getRequest()->getClientIp(), 'user-agent' => $this->getRequest()->headers->get('User-Agent')])]); }
/** * Deletes the remember-me cookie */ public function remove() { if ($this->cookie->has($this->name)) { $this->cookie->remove($this->name); } }
public function testGetQueuedCookies() { $this->cookieJar->set('cookie1', 'value1'); $this->cookieJar->set('cookie2', 'value2'); $this->assertCount(2, $this->cookieJar->getQueuedCookies()); }