protected function getRegisteredUser() { /* @var $auth \UthandoUser\Service\Authentication */ $auth = $this->getApplicationServiceLocator()->get('Zend\\Authentication\\AuthenticationService'); $user = new TestUserModel(); $user->setFirstname('Joe')->setLastname('Bloggs')->setEmail('*****@*****.**')->setRole('registered')->setDateCreated(new \DateTime())->setDateModified(new \DateTime()); $auth->getStorage()->write($user); return $user; }
public function testRegisteredUserRedirectsToHome() { /* @var $auth \UthandoUser\Service\Authentication */ $auth = $this->getApplicationServiceLocator()->get('Zend\\Authentication\\AuthenticationService'); $user = new TestUserModel(); $user->setFirstname('Joe')->setLastname('Bloggs')->setEmail('*****@*****.**')->setRole('registered'); $auth->getStorage()->write($user); $this->dispatch('/admin'); $this->assertResponseStatusCode(302); $this->assertRedirectTo('/'); }