refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s

This commit is contained in:
Kroonk
2026-05-22 16:19:55 +02:00
parent 38cc4c09ca
commit a213a1dba0
2215 changed files with 242567 additions and 6015 deletions

View File

@@ -0,0 +1,90 @@
<?php
namespace Tests\Feature;
use Tests\FeatureTestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class PasswordChangeTest extends FeatureTestCase
{
use DatabaseTransactions;
public function test_user_can_change_password()
{
$user = $this->signIn();
$user->password = $password = bcrypt('password');
$user->save();
$response = $this->followingRedirects()->post('/settings/security/passwordChange', [
'password_current' => 'password',
'password' => 'newPassword',
'password_confirmation' => 'newPassword',
]);
$response->assertStatus(200);
$response->assertSee('Password changed successfully.');
$user->refresh();
$this->assertNotEquals($password, $user->password);
}
public function test_current_password_checked()
{
$user = $this->signIn();
$user->password = bcrypt('password');
$user->save();
$response = $this->followingRedirects()->post('/settings/security/passwordChange', [
'password_current' => 'xpassword',
'password' => 'newPassword',
'password_confirmation' => 'newPassword',
]);
$response->assertStatus(200);
$response->assertSee('Current password you entered is not correct.');
}
public function test_new_password_policy_check()
{
$user = $this->signIn();
$user->password = bcrypt('password');
$user->save();
$response = $this->followingRedirects()->post('/settings/security/passwordChange', [
'password_current' => 'password',
'password' => 'admin',
'password_confirmation' => 'admin',
], [
'HTTP_REFERER' => '/settings/security',
]);
$response->assertStatus(200);
$response->assertSee('The password must be at least 6 characters.');
}
public function test_new_password_validation_check()
{
$user = $this->signIn();
$user->password = bcrypt('password');
$user->save();
$response = $this->followingRedirects()->post('/settings/security/passwordChange', [
'password_current' => 'password',
'password' => 'admin0',
'password_confirmation' => 'admin1',
], [
'HTTP_REFERER' => '/settings/security',
]);
$response->assertStatus(200);
$response->assertSee('The password confirmation does not match.');
}
}