コード例 #1
0
 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());
 }
コード例 #2
0
ファイル: AuthTest.php プロジェクト: webpants/YAWIK
 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());
 }