diff --git a/tests/SPT/Domain/Account/Adapters/AccountAdapterTest.php b/tests/SPT/Domain/Account/Adapters/AccountAdapterTest.php index 4a70fe6b..2474ce78 100644 --- a/tests/SPT/Domain/Account/Adapters/AccountAdapterTest.php +++ b/tests/SPT/Domain/Account/Adapters/AccountAdapterTest.php @@ -130,7 +130,7 @@ class AccountAdapterTest extends UnitaryTestCase public function testIncludeCustomFields(): void { $customFieldData = CustomFieldGenerator::factory()->buildSimpleModel(); - $customFieldsService = $this->createStub(CustomFieldDataService::class); + $customFieldsService = $this->createMock(CustomFieldDataService::class); $customFieldsService->expects(self::once()) ->method('getBy') ->willReturn([$customFieldData]); diff --git a/tests/SPT/Domain/Account/Services/AccountTest.php b/tests/SPT/Domain/Account/Services/AccountTest.php index 7f41eb35..92624250 100644 --- a/tests/SPT/Domain/Account/Services/AccountTest.php +++ b/tests/SPT/Domain/Account/Services/AccountTest.php @@ -64,17 +64,17 @@ use SPT\UnitaryTestCase; */ class AccountTest extends UnitaryTestCase { - private AccountRepository|MockObject $accountRepository; + private AccountRepository|MockObject $accountRepository; private AccountToUserGroupRepository|MockObject $accountToUserGroupRepository; - private AccountToUserRepository|MockObject $accountToUserRepository; + private AccountToUserRepository|MockObject $accountToUserRepository; private AccountToTagRepository|MockObject $accountToTagRepository; - private ItemPresetService|MockObject $itemPresetService; - private AccountHistoryService|MockObject $accountHistoryService; - private ConfigService|MockObject $configService; - private AccountCryptService|MockObject $accountCryptService; - private AccountPresetService|MockObject $accountPresetService; - private AccountItemsService|MockObject $accountItemsService; - private Account $account; + private ItemPresetService|MockObject $itemPresetService; + private AccountHistoryService|MockObject $accountHistoryService; + private ConfigService|MockObject $configService; + private AccountCryptService|MockObject $accountCryptService; + private AccountPresetService|MockObject $accountPresetService; + private AccountItemsService|MockObject $accountItemsService; + private Account $account; /** * @throws ServiceException @@ -1325,7 +1325,12 @@ class AccountTest extends UnitaryTestCase { parent::setUp(); - $this->accountRepository = $this->getMockForAbstractClass(AccountRepositoryStub::class); + $accountRepositoryMethods = array_filter( + get_class_methods(AccountRepositoryStub::class), + static fn(string $method) => $method != 'transactionAware' + ); + + $this->accountRepository = $this->createPartialMock(AccountRepositoryStub::class, $accountRepositoryMethods); $this->accountToUserGroupRepository = $this->createMock(AccountToUserGroupRepository::class); $this->accountToUserRepository = $this->createMock(AccountToUserRepository::class); $this->accountToTagRepository = $this->createMock(AccountToTagRepository::class); diff --git a/tests/SPT/Domain/Account/Services/UpgradePublicLinkTest.php b/tests/SPT/Domain/Account/Services/UpgradePublicLinkTest.php index 49599136..d1f15a02 100644 --- a/tests/SPT/Domain/Account/Services/UpgradePublicLinkTest.php +++ b/tests/SPT/Domain/Account/Services/UpgradePublicLinkTest.php @@ -82,8 +82,13 @@ class UpgradePublicLinkTest extends UnitaryTestCase { parent::setUp(); + $publicLinkRepositoryMethods = array_filter( + get_class_methods(PublicLinkRepositoryStub::class), + static fn(string $method) => $method != 'transactionAware' + ); + $this->publicLinkRepository = - $this->getMockForAbstractClass(PublicLinkRepositoryStub::class); + $this->createPartialMock(PublicLinkRepositoryStub::class, $publicLinkRepositoryMethods); $this->upgradePublicLinkService = new UpgradePublicLink($this->application, $this->publicLinkRepository); } diff --git a/tests/SPT/Domain/Export/Services/XmlAccountExportTest.php b/tests/SPT/Domain/Export/Services/XmlAccountExportTest.php index 0ba4d028..c3f00388 100644 --- a/tests/SPT/Domain/Export/Services/XmlAccountExportTest.php +++ b/tests/SPT/Domain/Export/Services/XmlAccountExportTest.php @@ -58,8 +58,6 @@ class XmlAccountExportTest extends UnitaryTestCase $account = AccountDataGenerator::factory()->buildAccount(); $tag = new Item(['id' => self::$faker->randomNumber(3)]); - $document = new DOMDocument(); - $this->accountService ->expects(self::once()) ->method('getAllBasic') @@ -107,8 +105,6 @@ class XmlAccountExportTest extends UnitaryTestCase */ public function testExportWithoutAccounts() { - $document = new DOMDocument(); - $this->accountService ->expects(self::once()) ->method('getAllBasic') @@ -130,8 +126,6 @@ class XmlAccountExportTest extends UnitaryTestCase */ public function testExportWithException() { - $document = new DOMDocument(); - $this->accountService ->expects(self::once()) ->method('getAllBasic') diff --git a/tests/SPT/Generators/AccountDataGenerator.php b/tests/SPT/Generators/AccountDataGenerator.php index 1e7febcd..5a3b7cbd 100644 --- a/tests/SPT/Generators/AccountDataGenerator.php +++ b/tests/SPT/Generators/AccountDataGenerator.php @@ -88,7 +88,7 @@ final class AccountDataGenerator extends DataGenerator 'passDateChange' => $this->faker->unixTime(), 'parentId' => $this->faker->randomNumber(3), 'publicLinkHash' => $this->faker->sha1(), - 'pass' => $this->faker->password(), + 'pass' => $this->faker->sha1(), 'key' => $this->faker->sha1(), ]; } @@ -153,9 +153,9 @@ final class AccountDataGenerator extends DataGenerator login: $this->faker->userName(), clientId: $this->faker->randomNumber(3), categoryId: $this->faker->randomNumber(3), - pass: $this->faker->password(), + pass: $this->faker->sha1(), userId: $this->faker->randomNumber(3), - key: $this->faker->password(), + key: $this->faker->sha1(), url: $this->faker->url(), notes: $this->faker->text(), userEditId: $this->faker->randomNumber(3), @@ -181,7 +181,7 @@ final class AccountDataGenerator extends DataGenerator login: $this->faker->userName(), clientId: $this->faker->randomNumber(3), categoryId: $this->faker->randomNumber(3), - pass: $this->faker->password(), + pass: $this->faker->sha1(), userId: $this->faker->randomNumber(3), url: $this->faker->url(), notes: $this->faker->text(), @@ -216,9 +216,9 @@ final class AccountDataGenerator extends DataGenerator login: $this->faker->userName(), clientId: $this->faker->randomNumber(3), categoryId: $this->faker->randomNumber(3), - pass: $this->faker->password(), + pass: $this->faker->sha1(), userId: $this->faker->randomNumber(3), - key: $this->faker->password(), + key: $this->faker->sha1(), url: $this->faker->url(), notes: $this->faker->text(), userEditId: $this->faker->randomNumber(3),