Ejemplo n.º 1
0
 public function testWhenActivationCodeIsInvalid()
 {
     $activationCode = uniqid();
     $this->activationRepo->expects($this->once())->method('FindUserIdByCode')->with($this->equalTo($activationCode))->will($this->returnValue(null));
     $result = $this->activation->Activate($activationCode);
     $this->assertFalse($result->Activated());
 }
Ejemplo n.º 2
0
 public function Activate($activationCode)
 {
     $userId = $this->activationRepository->FindUserIdByCode($activationCode);
     $this->activationRepository->DeleteActivation($activationCode);
     if ($userId != null) {
         $user = $this->userRepository->LoadById($userId);
         $user->Activate();
         $this->userRepository->Update($user);
         return new ActivationResult(true, $user);
     }
     return new ActivationResult(false);
 }