instances added god may help

This commit is contained in:
2026-02-23 12:58:19 +01:00
parent 25370a1a55
commit 99db252f60
290 changed files with 9858 additions and 4914 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace MintyPHP\Tests\Service\User;
use MintyPHP\Repository\User\UserWriteRepository;
use MintyPHP\Service\User\UserPasswordPolicyService;
use MintyPHP\Service\User\UserPasswordService;
use PHPUnit\Framework\TestCase;
class UserPasswordServiceTest extends TestCase
{
public function testResetPasswordRejectsWeakPassword(): void
{
$writeRepository = $this->createMock(UserWriteRepository::class);
$writeRepository->expects($this->never())->method('setPassword');
$service = new UserPasswordService(new UserPasswordPolicyService(), $writeRepository);
$result = $service->resetPassword(10, 'abc', 'abc');
$this->assertFalse($result['ok']);
$this->assertNotEmpty($result['errors']);
}
public function testResetPasswordUpdatesRepositoryOnValidInput(): void
{
$writeRepository = $this->createMock(UserWriteRepository::class);
$writeRepository->expects($this->once())
->method('setPassword')
->with(11, 'StrongPass1!')
->willReturn(true);
$service = new UserPasswordService(new UserPasswordPolicyService(), $writeRepository);
$result = $service->resetPassword(11, 'StrongPass1!', 'StrongPass1!');
$this->assertTrue($result['ok']);
}
}