setSystemConfiguration('user.password_reset', false); $this->request($client, $route, $method); $this->assertRouteNotFound($client); } public function testResetRequestWithDeactivatedFeature() { $this->testResetActionWithDeactivatedFeature('/resetting/request'); } public function testSendEmailRequestWithDeactivatedFeature() { $this->testResetActionWithDeactivatedFeature('/resetting/send-email', 'POST'); } public function testCheckEmailWithDeactivatedFeature() { $this->testResetActionWithDeactivatedFeature('/resetting/check-email'); } public function testResetWithDeactivatedFeature() { $this->testResetActionWithDeactivatedFeature('/resetting/reset/1234567890'); } public function testResetRequestPageIsRendered() { $client = self::createClient(); $this->setSystemConfiguration('user.password_reset', true); $this->request($client, '/resetting/request'); $response = $client->getResponse(); $this->assertTrue($response->isSuccessful()); $content = $response->getContent(); $this->assertStringContainsString('Kimai – Time Tracking', $content); $this->assertStringContainsString('Reset your password', $content); $this->assertStringContainsString('
', $content); $this->assertStringContainsString('assertStringContainsString('id="username" name="username" required="required"', $content); $this->assertStringContainsString('Reset your password', $content); $form = $client->getCrawler()->filter('form')->form(); $client->submit($form, [ 'username' => 'john_user', ]); $this->assertIsRedirect($client, $this->createUrl('/resetting/check-email?username=john_user')); $client->followRedirect(); $this->assertTrue($client->getResponse()->isSuccessful()); $user = $this->loadUserFromDatabase('john_user'); $token = $user->getConfirmationToken(); $this->request($client, '/resetting/reset/' . $token); $this->assertTrue($client->getResponse()->isSuccessful()); } }