public function testShouldGetByEmail()
 {
     // Make sure that our user will recieve confirm
     $confide_user = m::mock(new _mockedUser());
     $confide_user->shouldReceive('where')->with('email', '=', '*****@*****.**')->andReturn($confide_user)->once()->getMock()->shouldReceive('get')->andReturn($confide_user)->once()->getMock()->shouldReceive('first')->andReturn($confide_user)->once();
     // This will make sure that the mocked user will be returned
     // when calling `model()` (that will occur inside `repo->confirm()`)
     $this->repo->model = $confide_user;
     $this->assertEquals($confide_user, $this->repo->getUserByMail('*****@*****.**'));
 }
Ejemplo n.º 2
0
 /**
  * Change user password
  *
  * @return string
  */
 public function resetPassword($params)
 {
     $token = array_get($params, 'token', '');
     $email = $this->repo->getEmailByReminderToken($token);
     $user = $this->repo->getUserByMail($email);
     if ($user) {
         if ($user->resetPassword($params)) {
             // Password reset success, remove token from database
             $this->repo->deleteEmailByReminderToken($token);
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }