public function testResettingPassword() { User::setHasher($hasher = m::mock('Cartalyst\\Sentry\\Hashing\\HasherInterface')); $user = m::mock('Cartalyst\\Sentry\\Users\\Eloquent\\User[checkResetPasswordCode,save]'); $user->shouldReceive('checkResetPasswordCode')->with('reset_code')->andReturn(true); $hasher->shouldReceive('hash')->with('new_password')->once()->andReturn('hashed_new_password'); $user->shouldReceive('save')->once()->andReturn(true); $this->assertTrue($user->attemptResetPassword('reset_code', 'new_password')); $this->assertNull($user->reset_password_code); $this->assertEquals('hashed_new_password', $user->getPassword()); }