/** * Test the Auth::recall method. * * @group laravel */ public function testUserCanBeRecalledViaCookie() { Session::$instance = new Payload($this->getMock('Laravel\\Session\\Drivers\\Driver')); $cookie = Crypter::encrypt('1|' . Str::random(40)); Cookie::forever('authloginstub_remember', $cookie); $auth = new AuthLoginStub(); $this->assertEquals('Taylor Otwell', $auth->user()->name); $this->assertTrue($auth->user()->id === $_SERVER['auth.login.stub']['user']); }
/** * Test Cookie::forever method. * * @group laravel */ public function testForeverShouldUseATonOfMinutes() { Cookie::forever('foo', 'bar'); $this->assertEquals(Cookie::hash('bar') . '+bar', Cookie::$jar['foo']['value']); // Shouldn't be able to test this cause while we indicate -2000 seconds // cookie expiration store timestamp. // $this->assertEquals(525600, Cookie::$jar['foo']['expiration']); $this->setServerVar('HTTPS', 'on'); Cookie::forever('bar', 'baz', 'path', 'domain', true); $this->assertEquals('path', Cookie::$jar['bar']['path']); $this->assertEquals('domain', Cookie::$jar['bar']['domain']); $this->assertTrue(Cookie::$jar['bar']['secure']); $this->setServerVar('HTTPS', 'off'); }