public function testGet() { $cubex = new Cubex(); $request = new Request([], [], [], ['ckey' => 'cookie']); $cubex->instance('request', $request); $app = Cookie::getFacadeApplication(); Cookie::setFacadeApplication($cubex); $this->assertEquals('cookie', Cookie::get('ckey')); $this->assertEquals('default', Cookie::get('cs', 'default')); Cookie::setFacadeApplication($app); }
/** * Retrieve the user from the cookie * * @param bool $checkQueue * * @return IAuthedUser|null */ public function getCookieUser($checkQueue = true) { $cookied = Cookie::get($this->getCookieName(), null, $checkQueue); if ($cookied !== null) { $authedUser = $this->getCubex()->make('\\Cubex\\Auth\\AuthedUser'); if ($authedUser instanceof IAuthedUser) { try { $authedUser->unserialize($cookied); return $authedUser; } catch (\Exception $e) { } } } return null; }