public function testKeyCode()
 {
     $value = new UserActivation();
     $value->buildKeyCode(new ActivationKeyCodeGenerator());
     $bareValue = $value->getKeyCode();
     $this->assertTrue($value->compareKeyCode($bareValue));
 }
Example #2
0
 /**
  * Activates a user
  *
  * @param string $activationCode
  *
  * @throws ActivationException If the activation failed
  */
 public function activate($activationCode)
 {
     if ($this->isActivated()) {
         return;
     }
     if ($this->activation->compareKeyCode($activationCode)) {
         $this->activation = null;
         $this->updateLastAction(new \DateTime());
         return;
     }
     throw new ActivationException();
 }