Here is the code being tested
public function forgot($email)
{
try
{
// Find the user using the user email address
$user =$this->sentry->findUserByLogin($email);
$resetCode = $user->getResetPasswordCode();
return true;
}
catch (UserNotFoundException $e)
{
$this->errors[] = 'User was not found.';
return false;
}
}
Here is my spec code
function it_should_forgot(Sentry $sentry)
{
$email = 'johndavedecano@gmail.com';
$sentry->findUserByLogin($email)->shouldBeCalled();
$this->forgot($email);
}
Here is the error
PHP Fatal error: Call to a member function getResetPasswordCode() on a non-object in /var/www/laravel/app/Services/SentryService.php on line 103
Does anyone know how to properly test such method? Please also enlighten me why am i getting such error. Thanks inadvance
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community