|
10 | 10 |
|
11 | 11 | use Ibexa\Contracts\Core\Repository\Values\User\User; |
12 | 12 | use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; |
| 13 | +use Ibexa\Core\Base\Container\ApiLoader\RepositoryConfigurationProvider; |
13 | 14 | use Ibexa\Core\Repository\User\Exception\UnsupportedPasswordHashType; |
14 | 15 | use Ibexa\Core\Repository\User\PasswordHashService; |
15 | | -use PHPUnit\Framework\MockObject\MockObject; |
16 | | -use PHPUnit\Framework\TestCase; |
| 16 | +use Ibexa\Tests\Bundle\Core\ApiLoader\BaseRepositoryConfigurationProviderTestCase; |
17 | 17 |
|
18 | | -final class PasswordHashServiceTest extends TestCase |
| 18 | +final class PasswordHashServiceTest extends BaseRepositoryConfigurationProviderTestCase |
19 | 19 | { |
20 | 20 | private const int NON_EXISTING_PASSWORD_HASH = PHP_INT_MAX; |
21 | 21 |
|
22 | 22 | private PasswordHashService $passwordHashService; |
23 | 23 |
|
24 | 24 | protected function setUp(): void |
25 | 25 | { |
26 | | - $this->passwordHashService = new PasswordHashService($this->getConfigResolverMock()); |
27 | | - } |
28 | | - |
29 | | - private function getConfigResolverMock(): ConfigResolverInterface & MockObject |
30 | | - { |
31 | | - $configResolver = $this |
32 | | - ->createMock(ConfigResolverInterface::class); |
33 | | - |
34 | | - $configResolver |
35 | | - ->method('getParameter') |
36 | | - ->with('password_hash.default_type') |
37 | | - ->willReturn(User::PASSWORD_HASH_PHP_DEFAULT); |
38 | | - |
39 | | - $configResolver |
40 | | - ->method('getParameter') |
41 | | - ->with('password_hash.update_type_on_change') |
42 | | - ->willReturn(false); |
| 26 | + $repositories = [ |
| 27 | + 'legacy' => $this->buildNormalizedSingleRepositoryConfig('legacy'), |
| 28 | + ]; |
43 | 29 |
|
44 | | - return $configResolver; |
| 30 | + $configResolver = $this->createMock(ConfigResolverInterface::class); |
| 31 | + $repositoryConfigurationProvider = new RepositoryConfigurationProvider($configResolver, $repositories); |
| 32 | + $this->passwordHashService = new PasswordHashService($repositoryConfigurationProvider); |
45 | 33 | } |
46 | 34 |
|
47 | 35 | public function testGetSupportedHashTypes(): void |
|
0 commit comments