request('GET', '/'); $this->assertIsRedirect($client, $this->createUrl('/homepage')); $client->followRedirect(); $this->assertIsRedirect($client, $this->createUrl('/login')); } public function testLoginPageIsRendered() { $client = self::createClient(); $this->request($client, '/login'); $response = $client->getResponse(); $this->assertTrue($client->getResponse()->isSuccessful()); $content = $response->getContent(); $this->assertContains('Kimai – Time Tracking', $content); $this->assertContains('
', $content); $this->assertContains('assertContains('assertContains('assertContains('">Login', $content); $this->assertContains('assertContains('Register a new account', $content); } public function testRegisterAccountPageIsRendered() { $client = self::createClient(); $this->request($client, '/register/'); $response = $client->getResponse(); $this->assertTrue($response->isSuccessful()); $content = $response->getContent(); $this->assertContains('Kimai – Time Tracking', $content); $this->assertContains('Register a new account', $content); $this->assertContains('', $content); $this->assertContains('assertContains('id="fos_user_registration_form_email" name="fos_user_registration_form[email]" required="required"', $content); $this->assertContains('assertContains('id="fos_user_registration_form_username" name="fos_user_registration_form[username]" required="required" maxlength="60" pattern=".{3,}"', $content); $this->assertContains('assertContains('id="fos_user_registration_form_plainPassword_first" name="fos_user_registration_form[plainPassword][first]" required="required"', $content); $this->assertContains('id="fos_user_registration_form_plainPassword_second" name="fos_user_registration_form[plainPassword][second]" required="required"', $content); $this->assertContains('assertContains('id="fos_user_registration_form__token" name="fos_user_registration_form[_token]"', $content); $this->assertContains('>Register', $content); } public function testRegisterAccount() { $client = self::createClient(); $this->request($client, '/register/'); $response = $client->getResponse(); $this->assertTrue($response->isSuccessful()); $form = $client->getCrawler()->filter('form[name=fos_user_registration_form]')->form(); $client->submit($form, [ 'fos_user_registration_form' => [ 'email' => 'test@example.com', 'username' => 'example', 'plainPassword' => [ 'first' => 'test123', 'second' => 'test123', ], ] ]); $this->assertIsRedirect($client, $this->createUrl('/register/confirmed')); $client->followRedirect(); $this->assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); $this->assertContains('Kimai – Time Tracking', $content); $this->assertContains('

Congrats example, your account is now activated.

', $content); $this->assertContains('', $content); } }