public function testReturnGuestRoleIfNoIdentityIsFound() { $identityProvider = $this->getMock('ZfcRbac\\Identity\\IdentityProviderInterface'); $identityProvider->expects($this->any())->method('getIdentity')->will($this->returnValue(null)); $roleService = new RoleService($identityProvider, new InMemoryRoleProvider([]), $this->getMock('Rbac\\Traversal\\Strategy\\TraversalStrategyInterface')); $roleService->setGuestRole('guest'); $result = $roleService->getIdentityRoles(); $this->assertEquals('guest', $roleService->getGuestRole()); $this->assertCount(1, $result); $this->assertInstanceOf('Rbac\\Role\\RoleInterface', $result[0]); $this->assertEquals('guest', $result[0]->getName()); }