当前位置: 首页>>代码示例>>PHP>>正文


PHP AuthenticationService::expects方法代码示例

本文整理汇总了PHP中Zend\Authentication\AuthenticationService::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthenticationService::expects方法的具体用法?PHP AuthenticationService::expects怎么用?PHP AuthenticationService::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Authentication\AuthenticationService的用法示例。


在下文中一共展示了AuthenticationService::expects方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetUserSetting

 /**
  * @dataProvider provideUserInstance
  */
 public function testGetUserSetting($instance)
 {
     if (!$instance) {
         $mockUser = $this->getMock('ZfcUser\\Entity\\UserInterface');
         $this->authenticationService->expects($this->once())->method('getIdentity')->will($this->returnValue($mockUser));
     }
     $this->plugin->getUserSetting('allow_email', $instance);
 }
开发者ID:jzlosman,项目名称:ZfcUserSettings,代码行数:11,代码来源:UserSettingPluginTest.php

示例2: testGetAndHasIdentity

 /**
  * @covers ZfcUser\Controller\Plugin\ZfcUserAuthentication::hasIdentity
  * @covers ZfcUser\Controller\Plugin\ZfcUserAuthentication::getIdentity
  */
 public function testGetAndHasIdentity()
 {
     $this->SUT->setAuthService($this->mockedAuthenticationService);
     $callbackIndex = 0;
     $callback = function () use(&$callbackIndex) {
         $callbackIndex++;
         return (bool) ($callbackIndex % 2);
     };
     $this->mockedAuthenticationService->expects($this->any())->method('hasIdentity')->will($this->returnCallback($callback));
     $this->mockedAuthenticationService->expects($this->any())->method('getIdentity')->will($this->returnCallback($callback));
     $this->assertTrue($this->SUT->hasIdentity());
     $this->assertFalse($this->SUT->hasIdentity());
     $this->assertTrue($this->SUT->hasIdentity());
     $callbackIndex = 0;
     $this->assertTrue($this->SUT->getIdentity());
     $this->assertFalse($this->SUT->getIdentity());
     $this->assertTrue($this->SUT->getIdentity());
 }
开发者ID:projectsmahendra,项目名称:blogger,代码行数:22,代码来源:ZfcUserAuthenticationTest.php

示例3: testGetIdentityRolesRetrievesIdentityThatIsARole

 /**
  * @covers \BjyAuthorize\Provider\Identity\AuthenticationIdentityProvider::getIdentityRoles
  */
 public function testGetIdentityRolesRetrievesIdentityThatIsARole()
 {
     $user = $this->getMock('Zend\\Permissions\\Acl\\Role\\RoleInterface');
     $this->authService->expects($this->any())->method('getIdentity')->will($this->returnValue($user));
     $this->assertSame(array($user), $this->provider->getIdentityRoles());
 }
开发者ID:projectsmahendra,项目名称:blogger,代码行数:9,代码来源:AuthenticationIdentityProviderTest.php

示例4: testCanReturnIdentity

 public function testCanReturnIdentity()
 {
     $identity = $this->getMock('ZfjRbac\\Identity\\IdentityInterface');
     $this->authenticationService->expects($this->once())->method('getIdentity')->will($this->returnValue($identity));
     $this->assertSame($identity, $this->identityProvider->getIdentity());
 }
开发者ID:joacub,项目名称:zfj-rbac,代码行数:6,代码来源:AuthenticationIdentityProviderTest.php


注:本文中的Zend\Authentication\AuthenticationService::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。