/** * login using twitter */ public function loginAction() { $provider = $this->params()->fromRoute('provider'); try { $backend = $this->authenticator->authenticate($provider); if (!$backend->isAuthorized()) { throw new \UnexpectedValueException('User is not connected'); } $profile = $backend->getUserProfile(); // error_log(print_R($this->userWrapperFactory->factory($profile),true)); $this->session->offsetSet('authenticated', $backend->isAuthorized()); $this->session->offsetSet('user', $this->userWrapperFactory->factory($profile)); $this->session->offsetSet('backend', $backend); } catch (\Exception $e) { $this->session->offsetSet('authenticated', false); } return $this->doRedirect(); }
/** * @expectedException \UnexpectedValueException */ public function testCreationWithUnknownUserObject() { $factory = new UserWrapperFactory(); $userObj = $this->getMock('Hybridauth\\Entity\\Profile'); $factory->factory($userObj); }
/** * @expectedException \UnexpectedValueException */ public function testCreationWithUnknownUserObject() { $factory = new UserWrapperFactory(); $userObj = new \ArrayObject(); $factory->factory($userObj); }