Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -57,12 +57,12 @@ class PasswordResetControllerTest extends ControllerBaseTest
|
||||
$content = $response->getContent();
|
||||
$this->assertStringContainsString('<title>Kimai – Time Tracking</title>', $content);
|
||||
$this->assertStringContainsString('Reset your password', $content);
|
||||
$this->assertStringContainsString('<form action="/en/resetting/send-email" method="POST" class="fos_user_resetting_request">', $content);
|
||||
$this->assertStringContainsString('<form class="card-body security-password-reset" action="/en/resetting/send-email" method="post" autocomplete="off">', $content);
|
||||
$this->assertStringContainsString('<input type="text"', $content);
|
||||
$this->assertStringContainsString('id="username" name="username" required="required"', $content);
|
||||
$this->assertStringContainsString('>Reset your password</button>', $content);
|
||||
$this->assertStringContainsString('Reset your password', $content);
|
||||
|
||||
$form = $client->getCrawler()->filter('form.fos_user_resetting_request')->form();
|
||||
$form = $client->getCrawler()->filter('form')->form();
|
||||
$client->submit($form, [
|
||||
'username' => 'john_user',
|
||||
]);
|
||||
|
||||
@@ -45,10 +45,9 @@ class SecurityControllerTest extends ControllerBaseTest
|
||||
|
||||
$content = $response->getContent();
|
||||
$this->assertStringContainsString('<title>Kimai – Time Tracking</title>', $content);
|
||||
$this->assertStringContainsString('<form action="/en/login_check" method="post">', $content);
|
||||
$this->assertStringContainsString('<form action="/en/login_check" method="post"', $content);
|
||||
$this->assertStringContainsString('<input type="text" name="_username"', $content);
|
||||
$this->assertStringContainsString('<input name="_password" type="password"', $content);
|
||||
$this->assertStringContainsString('<input id="remember_me" name="_remember_me" type="checkbox"', $content);
|
||||
$this->assertStringContainsString('">Login</button>', $content);
|
||||
$this->assertStringContainsString('<input type="hidden" name="_csrf_token" value="', $content);
|
||||
$this->assertStringNotContainsString('<a href="/en/register/"', $content);
|
||||
@@ -112,7 +111,7 @@ class SecurityControllerTest extends ControllerBaseTest
|
||||
$client->followRedirect();
|
||||
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
self::assertStringContainsString('<div class="alert alert-danger">Invalid credentials.</div>', $client->getResponse()->getContent());
|
||||
self::assertStringContainsString('<div class="alert alert-important alert-danger">Invalid credentials.</div>', $client->getResponse()->getContent());
|
||||
}
|
||||
|
||||
public function testCheckAction()
|
||||
@@ -120,7 +119,7 @@ class SecurityControllerTest extends ControllerBaseTest
|
||||
$this->expectException(\RuntimeException::class);
|
||||
$this->expectExceptionMessage('You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.');
|
||||
|
||||
$client = self::createClient(); // just to bootstrap the container
|
||||
self::createClient(); // just to bootstrap the container
|
||||
$csrf = $this->createMock(CsrfTokenManagerInterface::class);
|
||||
$systemConfig = new SystemConfiguration(new TestConfigLoader([]), ['saml' => ['activate' => true]]);
|
||||
$samlConfig = new SamlConfiguration($systemConfig);
|
||||
@@ -133,7 +132,7 @@ class SecurityControllerTest extends ControllerBaseTest
|
||||
$this->expectException(\RuntimeException::class);
|
||||
$this->expectExceptionMessage('You must activate the logout in your security firewall configuration.');
|
||||
|
||||
$client = self::createClient(); // just to bootstrap the container
|
||||
self::createClient(); // just to bootstrap the container
|
||||
$csrf = $this->createMock(CsrfTokenManagerInterface::class);
|
||||
$systemConfig = new SystemConfiguration(new TestConfigLoader([]), ['saml' => ['activate' => true]]);
|
||||
$samlConfig = new SamlConfiguration($systemConfig);
|
||||
|
||||
@@ -58,16 +58,16 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
|
||||
$content = $response->getContent();
|
||||
$this->assertStringContainsString('<title>Kimai – Time Tracking</title>', $content);
|
||||
$this->assertStringContainsString('Register a new account', $content);
|
||||
$this->assertStringContainsString('<form name="fos_user_registration_form" method="post" action="/en/register/" class="fos_user_registration_register">', $content);
|
||||
$this->assertStringContainsString('<form name="user_registration_form" method="post" action="/en/register/"', $content);
|
||||
$this->assertStringContainsString('<input type="email"', $content);
|
||||
$this->assertStringContainsString('id="fos_user_registration_form_email" name="fos_user_registration_form[email]" required="required"', $content);
|
||||
$this->assertStringContainsString('id="user_registration_form_email" name="user_registration_form[email]" required="required"', $content);
|
||||
$this->assertStringContainsString('<input type="text"', $content);
|
||||
$this->assertStringContainsString('id="fos_user_registration_form_username" name="fos_user_registration_form[username]" required="required" maxlength="60" pattern=".{2,}"', $content);
|
||||
$this->assertStringContainsString('id="user_registration_form_username" name="user_registration_form[username]" required="required" maxlength="60" pattern=".{2,}"', $content);
|
||||
$this->assertStringContainsString('<input type="password"', $content);
|
||||
$this->assertStringContainsString('id="fos_user_registration_form_plainPassword_first" name="fos_user_registration_form[plainPassword][first]" required="required"', $content);
|
||||
$this->assertStringContainsString('id="fos_user_registration_form_plainPassword_second" name="fos_user_registration_form[plainPassword][second]" required="required"', $content);
|
||||
$this->assertStringContainsString('id="user_registration_form_plainPassword_first" name="user_registration_form[plainPassword][first]" required="required"', $content);
|
||||
$this->assertStringContainsString('id="user_registration_form_plainPassword_second" name="user_registration_form[plainPassword][second]" required="required"', $content);
|
||||
$this->assertStringContainsString('<input type="hidden"', $content);
|
||||
$this->assertStringContainsString('id="fos_user_registration_form__token" name="fos_user_registration_form[_token]"', $content);
|
||||
$this->assertStringContainsString('id="user_registration_form__token" name="user_registration_form[_token]"', $content);
|
||||
$this->assertStringContainsString('>Register</button>', $content);
|
||||
}
|
||||
|
||||
@@ -79,9 +79,9 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
|
||||
$response = $client->getResponse();
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
|
||||
$form = $client->getCrawler()->filter('form[name=fos_user_registration_form]')->form();
|
||||
$form = $client->getCrawler()->filter('form[name=user_registration_form]')->form();
|
||||
$client->submit($form, [
|
||||
'fos_user_registration_form' => [
|
||||
'user_registration_form' => [
|
||||
'email' => $email,
|
||||
'username' => $username,
|
||||
'plainPassword' => [
|
||||
@@ -171,7 +171,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
|
||||
$client = self::createClient();
|
||||
$this->setSystemConfiguration('user.registration', true);
|
||||
|
||||
$this->assertHasValidationError($client, '/register/', 'form[name=fos_user_registration_form]', $formData, $validationFields);
|
||||
$this->assertHasValidationError($client, '/register/', 'form[name=user_registration_form]', $formData, $validationFields);
|
||||
}
|
||||
|
||||
public function getValidationTestData()
|
||||
@@ -180,44 +180,44 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
|
||||
[
|
||||
// invalid fields: username, password_second, email
|
||||
[
|
||||
'fos_user_registration_form' => [
|
||||
'user_registration_form' => [
|
||||
'username' => '',
|
||||
'plainPassword' => ['first' => 'sdfsdf123'],
|
||||
'email' => '',
|
||||
]
|
||||
],
|
||||
[
|
||||
'#fos_user_registration_form_username',
|
||||
'#fos_user_registration_form_plainPassword_first',
|
||||
'#fos_user_registration_form_email',
|
||||
'#user_registration_form_username',
|
||||
'#user_registration_form_plainPassword_first',
|
||||
'#user_registration_form_email',
|
||||
]
|
||||
],
|
||||
// invalid fields: username, password, email
|
||||
[
|
||||
[
|
||||
'fos_user_registration_form' => [
|
||||
'user_registration_form' => [
|
||||
'username' => 'x',
|
||||
'plainPassword' => ['first' => 'sdfsdf123', 'second' => 'sdfxxxxxxx'],
|
||||
'email' => 'ydfbvsdfgs',
|
||||
]
|
||||
],
|
||||
[
|
||||
'#fos_user_registration_form_username',
|
||||
'#fos_user_registration_form_plainPassword_first',
|
||||
'#fos_user_registration_form_email',
|
||||
'#user_registration_form_username',
|
||||
'#user_registration_form_plainPassword_first',
|
||||
'#user_registration_form_email',
|
||||
]
|
||||
],
|
||||
// invalid fields: password (too short)
|
||||
[
|
||||
[
|
||||
'fos_user_registration_form' => [
|
||||
'user_registration_form' => [
|
||||
'username' => 'test123',
|
||||
'plainPassword' => ['first' => 'test123', 'second' => 'test123'],
|
||||
'email' => 'ydfbvsdfgs@example.com',
|
||||
]
|
||||
],
|
||||
[
|
||||
'#fos_user_registration_form_plainPassword_first',
|
||||
'#user_registration_form_plainPassword_first',
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user