Example #1
0
 public function setUp()
 {
     $this->id = ReminderId::generate();
     $this->email = new Email('*****@*****.**');
     $this->code = ReminderCode::generate();
     $this->timestamp = Carbon::create(2014, 10, 11, 10, 23, 34);
     Carbon::setTestNow($this->timestamp);
     $this->reminder = new Reminder($this->id, $this->email, $this->code);
 }
Example #2
0
 /**
  * Request a password reminder Token
  *
  * @param string $email
  * @return Reminder
  */
 public function request($email)
 {
     $email = Email::fromNative($email);
     $this->findUserByEmail($email);
     $this->reminders->deleteExistingRemindersForEmail($email);
     $id = $this->reminders->nextIdentity();
     $reminder = new Reminder($id, $email, ReminderCode::generate());
     $this->reminders->add($reminder);
     return $reminder;
 }
Example #3
0
 public function setUp()
 {
     parent::setUp();
     $this->user = UserStub::create();
     $this->fixture = ['id' => ReminderId::generate(), 'code' => ReminderCode::generate(), 'email' => new Email('*****@*****.**')];
     $this->users = m::mock('Cffs\\Domain\\Model\\Identity\\UserRepository');
     $this->reminders = m::mock('Cffs\\Domain\\Model\\Identity\\ReminderRepository');
     $this->hasher = m::mock('Cffs\\Domain\\Services\\Identity\\HashingService');
     $this->service = new ReminderService($this->reminders, $this->users, $this->hasher);
 }
Example #4
0
 /** @test */
 public function should_throw_exception_if_code_generation_fails()
 {
     $this->setExpectedException('RuntimeException');
     $code = ReminderCode::generate(null);
 }