/** * Reset a user's password * * @param string $email * @param string $password * @param string $code * @return User; */ public function reset($email, $password, $code) { $this->validate($email); $user = $this->service->reset($email, $password, $code); /* Dispatch Domain Events */ return $user; }
/** @test */ public function should_reset_password_and_return_user() { $reminder = new Reminder($this->fixture['id'], $this->fixture['email'], $this->fixture['code']); $this->reminders->shouldReceive('findReminderByEmailAndCode')->andReturn($reminder); $this->users->shouldReceive('userOfEmail')->andReturn($this->user); $this->hasher->shouldReceive('hash')->andReturn(new HashedPassword('qwerty123')); $this->users->shouldReceive('update'); $this->reminders->shouldReceive('deleteReminderByCode'); $user = $this->service->reset('*****@*****.**', 'qwerty123', 'abc123'); $this->assertInstanceOf('Cffs\\Domain\\Model\\Identity\\User', $user); }