public function testIsLoggedInMirrorsToAuthServiceHasIdentity() { $auth = $this->getAuthMock(); $auth->expects($this->once())->method('hasIdentity')->will($this->returnValue(true)); $helper = new Auth(); $helper->setService($auth); $this->assertTrue($helper->isLoggedIn()); }
public function testIsAbleToCheckIfAUserIsCurrentlyLoggedIn() { $auth = $this->getMockBuilder('Auth\\AuthenticationService')->disableOriginalConstructor()->getMock(); $auth->expects($this->exactly(2))->method('hasIdentity')->will($this->onConsecutiveCalls(true, false)); $target = new AuthHelper(); $target->setService($auth); $this->assertTrue($target->isLoggedIn()); $this->assertFalse($target->isLoggedIn()); }