/** * @covers ZfcUser\Authentication\Storage\Db::read */ public function testReadWithoutResolvedEntitySetIdentityObject() { $user = $this->getMock('ZfcUser\\Entity\\User'); $user->setUsername('zfcUser'); $this->storage->expects($this->once())->method('read')->will($this->returnValue($user)); $this->db->setStorage($this->storage); $result = $this->db->read(); $this->assertSame($user, $result); }
public function read() { $identity = parent::read(); /* @var $config \SkelletonApplication\Options\ZfcUserModuleOptions */ $config = $this->getServiceManager()->get('zfcuser_module_options'); // If userState is enabled, check if user is allowed to log in if ($config->getEnableUserState() && !in_array($identity->getState(), $config->getAllowedLoginStates())) { $this->clear(); return $this->resolvedIdentity; } return $identity; }