Ejemplo n.º 1
0
 public function testWhenAccountCannotBeActivated()
 {
     $activationFailed = new ActivationResult(false);
     $this->accountActivation->_ActivationResult = $activationFailed;
     $activationCode = uniqid();
     $this->page->expects($this->once())->method('GetActivationCode')->will($this->returnValue($activationCode));
     $this->page->expects($this->once())->method('ShowError');
     $this->presenter->PageLoad();
 }
Ejemplo n.º 2
0
 public function PageLoad()
 {
     $activationCode = $this->page->GetActivationCode();
     if (empty($activationCode)) {
         $this->page->ShowSent();
     } else {
         $activationResult = $this->accountActivation->Activate($activationCode);
         if ($activationResult->Activated()) {
             $user = $activationResult->User();
             $this->authentication->Login($user->EmailAddress(), new WebLoginContext(new LoginData(false, $user->Language())));
             $this->page->Redirect(Pages::UrlFromId($user->Homepage()));
         } else {
             $this->page->ShowError();
         }
     }
 }