From 3825ab391d73e8dbdf946af9c186041a98bfd5d4 Mon Sep 17 00:00:00 2001 From: Anton Fedurtsya Date: Wed, 6 Dec 2023 10:20:56 +0200 Subject: [PATCH 1/5] OXDEV-7647 Add exceptions the interfaces dockblocks Signed-off-by: Anton Fedurtsya --- .../Infrastructure/ShopSettingRepository.php | 7 ++- .../ShopSettingRepositoryInterface.php | 54 +++++++++++++++++++ .../Infrastructure/ThemeSettingRepository.php | 54 +++++++------------ .../ThemeSettingRepositoryInterface.php | 53 ++++++++++++++++++ .../CollectionEncodingServiceInterface.php | 9 ++++ .../Service/JsonCollectionEncodingService.php | 6 --- .../ThemeSettingRepositorySettersTest.php | 14 ++--- 7 files changed, 143 insertions(+), 54 deletions(-) diff --git a/src/Setting/Infrastructure/ShopSettingRepository.php b/src/Setting/Infrastructure/ShopSettingRepository.php index 4d54d51..d7034b3 100644 --- a/src/Setting/Infrastructure/ShopSettingRepository.php +++ b/src/Setting/Infrastructure/ShopSettingRepository.php @@ -149,7 +149,7 @@ public function getSettingsList(): array /** * @throws WrongSettingTypeException */ - public function checkSettingType(ShopConfigurationSetting $value, string $requiredType): void + protected function checkSettingType(ShopConfigurationSetting $value, string $requiredType): void { if ($value->getType() !== $requiredType) { throw new WrongSettingTypeException(); @@ -159,7 +159,7 @@ public function checkSettingType(ShopConfigurationSetting $value, string $requir /** * @throws WrongSettingValueException */ - public function getArrayFromSettingValue(ShopConfigurationSetting $setting): array + protected function getArrayFromSettingValue(ShopConfigurationSetting $setting): array { $value = $setting->getValue(); @@ -209,6 +209,9 @@ public function saveAssocCollectionSetting(string $name, array $value): void $this->saveAsType(FieldType::ASSOCIATIVE_ARRAY, $name, $value); } + /** + * @throws WrongSettingTypeException + */ private function saveAsType(string $type, string $name, mixed $value): void { $this->validateOriginalSettingType($name, $type); diff --git a/src/Setting/Infrastructure/ShopSettingRepositoryInterface.php b/src/Setting/Infrastructure/ShopSettingRepositoryInterface.php index b3530f1..751a98f 100644 --- a/src/Setting/Infrastructure/ShopSettingRepositoryInterface.php +++ b/src/Setting/Infrastructure/ShopSettingRepositoryInterface.php @@ -7,38 +7,92 @@ namespace OxidEsales\GraphQL\ConfigurationAccess\Setting\Infrastructure; +use OxidEsales\GraphQL\ConfigurationAccess\Setting\Exception\NoSettingsFoundForShopException; +use OxidEsales\GraphQL\ConfigurationAccess\Setting\Exception\WrongSettingTypeException; +use OxidEsales\GraphQL\ConfigurationAccess\Setting\Exception\WrongSettingValueException; + interface ShopSettingRepositoryInterface { + /** + * @throws WrongSettingTypeException + * @throws WrongSettingValueException + */ public function getInteger(string $name): int; + /** + * @throws WrongSettingTypeException + * @throws WrongSettingValueException + */ public function getFloat(string $name): float; + /** + * @throws WrongSettingTypeException + * @throws WrongSettingValueException + */ public function getBoolean(string $name): bool; + /** + * @throws WrongSettingTypeException + * @throws WrongSettingValueException + */ public function getString(string $name): string; + /** + * @throws WrongSettingTypeException + * @throws WrongSettingValueException + */ public function getSelect(string $name): string; + /** + * @throws WrongSettingTypeException + * @throws WrongSettingValueException + */ public function getCollection(string $name): array; + /** + * @throws WrongSettingTypeException + * @throws WrongSettingValueException + */ public function getAssocCollection(string $name): array; /** + * @throws NoSettingsFoundForShopException * @return array */ public function getSettingsList(): array; + /** + * @throws WrongSettingTypeException + */ public function saveIntegerSetting(string $name, int $value): void; + /** + * @throws WrongSettingTypeException + */ public function saveFloatSetting(string $name, float $value): void; + /** + * @throws WrongSettingTypeException + */ public function saveBooleanSetting(string $name, bool $value): void; + /** + * @throws WrongSettingTypeException + */ public function saveStringSetting(string $name, string $value): void; + /** + * @throws WrongSettingTypeException + */ public function saveSelectSetting(string $name, string $value): void; + /** + * @throws WrongSettingTypeException + */ public function saveCollectionSetting(string $name, array $value): void; + /** + * @throws WrongSettingTypeException + */ public function saveAssocCollectionSetting(string $name, array $value): void; } diff --git a/src/Setting/Infrastructure/ThemeSettingRepository.php b/src/Setting/Infrastructure/ThemeSettingRepository.php index ec73c7a..f26a7f8 100644 --- a/src/Setting/Infrastructure/ThemeSettingRepository.php +++ b/src/Setting/Infrastructure/ThemeSettingRepository.php @@ -151,65 +151,37 @@ public function getSettingsList(string $themeId): array public function saveIntegerSetting(string $name, int $value, string $themeId): void { - $this->getInteger($name, $themeId); - - $value = $this->shopSettingEncoder->encode(FieldType::NUMBER, $value); - - $this->saveSettingValue($name, $themeId, (string)$value); + $this->saveSettingAsType(FieldType::NUMBER, $name, $themeId, $value); } public function saveFloatSetting(string $name, float $value, string $themeId): void { - $this->getFloat($name, $themeId); - - $value = $this->shopSettingEncoder->encode(FieldType::NUMBER, $value); - - $this->saveSettingValue($name, $themeId, (string)$value); + $this->saveSettingAsType(FieldType::NUMBER, $name, $themeId, $value); } public function saveBooleanSetting(string $name, bool $value, string $themeId): void { - $this->getBoolean($name, $themeId); - - $value = $this->shopSettingEncoder->encode(FieldType::BOOLEAN, $value); - - $this->saveSettingValue($name, $themeId, (string)$value); + $this->saveSettingAsType(FieldType::BOOLEAN, $name, $themeId, $value); } public function saveStringSetting(string $name, string $value, string $themeId): void { - $this->getString($name, $themeId); - - $value = $this->shopSettingEncoder->encode(FieldType::STRING, $value); - - $this->saveSettingValue($name, $themeId, (string)$value); + $this->saveSettingAsType(FieldType::STRING, $name, $themeId, $value); } public function saveSelectSetting(string $name, string $value, string $themeId): void { - $this->getSelect($name, $themeId); - - $value = $this->shopSettingEncoder->encode(FieldType::SELECT, $value); - - $this->saveSettingValue($name, $themeId, (string)$value); + $this->saveSettingAsType(FieldType::SELECT, $name, $themeId, $value); } public function saveCollectionSetting(string $name, array $value, string $themeId): void { - $this->getCollection($name, $themeId); - - $value = $this->shopSettingEncoder->encode(FieldType::ARRAY, $value); - - $this->saveSettingValue($name, $themeId, (string)$value); + $this->saveSettingAsType(FieldType::ARRAY, $name, $themeId, $value); } public function saveAssocCollectionSetting(string $name, array $value, string $themeId): void { - $this->getAssocCollection($name, $themeId); - - $value = $this->shopSettingEncoder->encode(FieldType::ASSOCIATIVE_ARRAY, $value); - - $this->saveSettingValue($name, $themeId, (string)$value); + $this->saveSettingAsType(FieldType::ASSOCIATIVE_ARRAY, $name, $themeId, $value); } protected function getSettingValue(string $name, string $fieldType, string $theme): mixed @@ -267,4 +239,16 @@ protected function saveSettingValue(string $name, string $themeId, string $value ) ); } + + /** + * @throws NoSettingsFoundForThemeException + */ + protected function saveSettingAsType(string $settingType, string $name, string $themeId, mixed $value): void + { + $this->getSettingValue($name, $settingType, $themeId); + + $value = $this->shopSettingEncoder->encode($settingType, $value); + + $this->saveSettingValue($name, $themeId, (string)$value); + } } diff --git a/src/Setting/Infrastructure/ThemeSettingRepositoryInterface.php b/src/Setting/Infrastructure/ThemeSettingRepositoryInterface.php index 8302430..72e79c4 100644 --- a/src/Setting/Infrastructure/ThemeSettingRepositoryInterface.php +++ b/src/Setting/Infrastructure/ThemeSettingRepositoryInterface.php @@ -7,38 +7,91 @@ namespace OxidEsales\GraphQL\ConfigurationAccess\Setting\Infrastructure; +use OxidEsales\GraphQL\ConfigurationAccess\Setting\Exception\NoSettingsFoundForThemeException; +use OxidEsales\GraphQL\ConfigurationAccess\Setting\Exception\WrongSettingValueException; + interface ThemeSettingRepositoryInterface { + /** + * @throws NoSettingsFoundForThemeException + * @throws WrongSettingValueException + */ public function getInteger(string $name, string $themeId): int; + /** + * @throws NoSettingsFoundForThemeException + * @throws WrongSettingValueException + */ public function getFloat(string $name, string $themeId): float; + /** + * @throws NoSettingsFoundForThemeException + * @throws WrongSettingValueException + */ public function getBoolean(string $name, string $themeId): bool; + /** + * @throws NoSettingsFoundForThemeException + * @throws WrongSettingValueException + */ public function getString(string $name, string $themeId): string; + /** + * @throws NoSettingsFoundForThemeException + * @throws WrongSettingValueException + */ public function getSelect(string $name, string $themeId): string; + /** + * @throws NoSettingsFoundForThemeException + * @throws WrongSettingValueException + */ public function getCollection(string $name, string $themeId): array; + /** + * @throws NoSettingsFoundForThemeException + * @throws WrongSettingValueException + */ public function getAssocCollection(string $name, string $themeId): array; /** + * @throws NoSettingsFoundForThemeException * @return array */ public function getSettingsList(string $themeId): array; + /** + * @throws NoSettingsFoundForThemeException + */ public function saveIntegerSetting(string $name, int $value, string $themeId): void; + /** + * @throws NoSettingsFoundForThemeException + */ public function saveFloatSetting(string $name, float $value, string $themeId): void; + /** + * @throws NoSettingsFoundForThemeException + */ public function saveBooleanSetting(string $name, bool $value, string $themeId): void; + /** + * @throws NoSettingsFoundForThemeException + */ public function saveStringSetting(string $name, string $value, string $themeId): void; + /** + * @throws NoSettingsFoundForThemeException + */ public function saveSelectSetting(string $name, string $value, string $themeId): void; + /** + * @throws NoSettingsFoundForThemeException + */ public function saveCollectionSetting(string $name, array $value, string $themeId): void; + /** + * @throws NoSettingsFoundForThemeException + */ public function saveAssocCollectionSetting(string $name, array $value, string $themeId): void; } diff --git a/src/Setting/Service/CollectionEncodingServiceInterface.php b/src/Setting/Service/CollectionEncodingServiceInterface.php index 5a141a2..e3f83bd 100644 --- a/src/Setting/Service/CollectionEncodingServiceInterface.php +++ b/src/Setting/Service/CollectionEncodingServiceInterface.php @@ -7,9 +7,18 @@ namespace OxidEsales\GraphQL\ConfigurationAccess\Setting\Service; +use OxidEsales\GraphQL\ConfigurationAccess\Setting\Exception\CollectionEncodingException; +use OxidEsales\GraphQL\ConfigurationAccess\Setting\Exception\InvalidCollectionException; + interface CollectionEncodingServiceInterface { + /** + * @throws CollectionEncodingException + */ public function encodeArrayToString(array $collection): string; + /** + * @throws InvalidCollectionException + */ public function decodeStringCollectionToArray(string $value): array; } diff --git a/src/Setting/Service/JsonCollectionEncodingService.php b/src/Setting/Service/JsonCollectionEncodingService.php index ca7f054..882f9b6 100644 --- a/src/Setting/Service/JsonCollectionEncodingService.php +++ b/src/Setting/Service/JsonCollectionEncodingService.php @@ -14,9 +14,6 @@ class JsonCollectionEncodingService implements CollectionEncodingServiceInterface { - /** - * @throws CollectionEncodingException - */ public function encodeArrayToString(array $collection): string { $jsonValue = json_encode($collection); @@ -27,9 +24,6 @@ public function encodeArrayToString(array $collection): string return $jsonValue; } - /** - * @throws InvalidCollectionException - */ public function decodeStringCollectionToArray(string $value): array { if ($value === '') { diff --git a/tests/Unit/Infrastructure/ThemeSettingRepositorySettersTest.php b/tests/Unit/Infrastructure/ThemeSettingRepositorySettersTest.php index 1669074..9006624 100644 --- a/tests/Unit/Infrastructure/ThemeSettingRepositorySettersTest.php +++ b/tests/Unit/Infrastructure/ThemeSettingRepositorySettersTest.php @@ -20,16 +20,15 @@ class ThemeSettingRepositorySettersTest extends AbstractThemeSettingRepositoryTe * @dataProvider notExistingSettingCheckTriggerDataProvider */ public function testSetterThrowsExceptionOnNotExistingSetting( - string $checkMethod, string $repositoryMethod, mixed $value, ): void { $name = 'notExistingSetting'; $themeId = 'awesomeTheme'; - $repository = $this->getSut(methods: [$checkMethod]); - $repository->method($checkMethod) - ->with($name, $themeId) + $repository = $this->getSut(methods: ['getSettingValue']); + $repository->method('getSettingValue') + ->with($name, $this->anything(), $themeId) ->willThrowException(new NoSettingsFoundForThemeException($themeId)); $this->expectException(NoSettingsFoundForThemeException::class); @@ -40,37 +39,30 @@ public function testSetterThrowsExceptionOnNotExistingSetting( public function notExistingSettingCheckTriggerDataProvider(): \Generator { yield "saveIntegerSetting" => [ - 'checkMethod' => 'getInteger', 'repositoryMethod' => 'saveIntegerSetting', 'value' => 1234 ]; yield "saveFloatSetting" => [ - 'checkMethod' => 'getFloat', 'repositoryMethod' => 'saveFloatSetting', 'value' => 1_23 ]; yield "saveBooleanSetting" => [ - 'checkMethod' => 'getBoolean', 'repositoryMethod' => 'saveBooleanSetting', 'value' => true ]; yield "saveStringSetting" => [ - 'checkMethod' => 'getString', 'repositoryMethod' => 'saveStringSetting', 'value' => 'some string' ]; yield "saveSelectSetting" => [ - 'checkMethod' => 'getSelect', 'repositoryMethod' => 'saveSelectSetting', 'value' => 'some select' ]; yield "saveCollectionSetting" => [ - 'checkMethod' => 'getCollection', 'repositoryMethod' => 'saveCollectionSetting', 'value' => ['collection'] ]; yield "saveAssocCollectionSetting" => [ - 'checkMethod' => 'getAssocCollection', 'repositoryMethod' => 'saveAssocCollectionSetting', 'value' => ['collection'] ]; From 8dba2d7ffed62226d9b72bfd2ce5e5c989bbccfe Mon Sep 17 00:00:00 2001 From: marcelmanzel Date: Wed, 6 Dec 2023 16:28:04 +0100 Subject: [PATCH 2/5] OXDEV-7647: Remove ShopSettingEncoder in ShopRepository --- src/Setting/Infrastructure/ShopSettingRepository.php | 4 +--- .../Integration/Infrastructure/ShopSettingRepositoryTest.php | 2 -- .../Infrastructure/AbstractShopSettingRepositoryTestCase.php | 2 -- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Setting/Infrastructure/ShopSettingRepository.php b/src/Setting/Infrastructure/ShopSettingRepository.php index d7034b3..503db96 100644 --- a/src/Setting/Infrastructure/ShopSettingRepository.php +++ b/src/Setting/Infrastructure/ShopSettingRepository.php @@ -12,7 +12,6 @@ use Doctrine\DBAL\Result; use OxidEsales\EshopCommunity\Internal\Framework\Config\Dao\ShopConfigurationSettingDaoInterface; use OxidEsales\EshopCommunity\Internal\Framework\Config\DataObject\ShopConfigurationSetting; -use OxidEsales\EshopCommunity\Internal\Framework\Config\Utility\ShopSettingEncoderInterface; use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface; use OxidEsales\EshopCommunity\Internal\Transition\Utility\BasicContextInterface; use OxidEsales\GraphQL\ConfigurationAccess\Setting\Enum\FieldType; @@ -25,8 +24,7 @@ final class ShopSettingRepository implements ShopSettingRepositoryInterface public function __construct( private BasicContextInterface $basicContext, private QueryBuilderFactoryInterface $queryBuilderFactory, - protected ShopSettingEncoderInterface $shopSettingEncoder, - protected ShopConfigurationSettingDaoInterface $configurationSettingDao, + private ShopConfigurationSettingDaoInterface $configurationSettingDao, ) { } diff --git a/tests/Integration/Infrastructure/ShopSettingRepositoryTest.php b/tests/Integration/Infrastructure/ShopSettingRepositoryTest.php index 7bdd838..5febf68 100644 --- a/tests/Integration/Infrastructure/ShopSettingRepositoryTest.php +++ b/tests/Integration/Infrastructure/ShopSettingRepositoryTest.php @@ -11,7 +11,6 @@ use Doctrine\DBAL\Connection; use OxidEsales\EshopCommunity\Internal\Framework\Config\Dao\ShopConfigurationSettingDaoInterface; -use OxidEsales\EshopCommunity\Internal\Framework\Config\Utility\ShopSettingEncoderInterface; use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface; use OxidEsales\EshopCommunity\Internal\Transition\Utility\BasicContextInterface; use OxidEsales\EshopCommunity\Tests\Integration\IntegrationTestCase; @@ -87,7 +86,6 @@ public function getSutForShop(int $shopId): ShopSettingRepository $sut = new ShopSettingRepository( basicContext: $basicContext, queryBuilderFactory: $this->get(QueryBuilderFactoryInterface::class), - shopSettingEncoder: $this->get(ShopSettingEncoderInterface::class), configurationSettingDao: $this->get(ShopConfigurationSettingDaoInterface::class) ); diff --git a/tests/Unit/Infrastructure/AbstractShopSettingRepositoryTestCase.php b/tests/Unit/Infrastructure/AbstractShopSettingRepositoryTestCase.php index fdf3bbb..7d5cbf2 100644 --- a/tests/Unit/Infrastructure/AbstractShopSettingRepositoryTestCase.php +++ b/tests/Unit/Infrastructure/AbstractShopSettingRepositoryTestCase.php @@ -21,13 +21,11 @@ abstract class AbstractShopSettingRepositoryTestCase extends AbstractDatabaseSet protected function getSut( ?BasicContextInterface $basicContext = null, ?QueryBuilderFactoryInterface $queryBuilderFactory = null, - ?ShopSettingEncoderInterface $shopSettingEncoder = null, ?ShopConfigurationSettingDaoInterface $shopSettingDao = null, ): ShopSettingRepositoryInterface { return new ShopSettingRepository( basicContext: $basicContext ?? $this->createStub(BasicContextInterface::class), queryBuilderFactory: $queryBuilderFactory ?? $this->createStub(QueryBuilderFactoryInterface::class), - shopSettingEncoder: $shopSettingEncoder ?? $this->createStub(ShopSettingEncoderInterface::class), configurationSettingDao: $shopSettingDao ?? $this->createStub(ShopConfigurationSettingDaoInterface::class), ); } From e78f9d0bd8bc22e5abfc3c33c83db554f3e68902 Mon Sep 17 00:00:00 2001 From: marcelmanzel Date: Wed, 6 Dec 2023 16:31:03 +0100 Subject: [PATCH 3/5] OXDEV-7647: Change all protected methods to private in ShopSettingRepository --- src/Setting/Infrastructure/ShopSettingRepository.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Setting/Infrastructure/ShopSettingRepository.php b/src/Setting/Infrastructure/ShopSettingRepository.php index 503db96..badb8f0 100644 --- a/src/Setting/Infrastructure/ShopSettingRepository.php +++ b/src/Setting/Infrastructure/ShopSettingRepository.php @@ -111,7 +111,7 @@ public function getAssocCollection(string $name): array return $this->getArrayFromSettingValue($setting); } - protected function getShopSetting(string $name): ShopConfigurationSetting + private function getShopSetting(string $name): ShopConfigurationSetting { return $this->configurationSettingDao->get($name, $this->basicContext->getCurrentShopId()); } @@ -147,7 +147,7 @@ public function getSettingsList(): array /** * @throws WrongSettingTypeException */ - protected function checkSettingType(ShopConfigurationSetting $value, string $requiredType): void + private function checkSettingType(ShopConfigurationSetting $value, string $requiredType): void { if ($value->getType() !== $requiredType) { throw new WrongSettingTypeException(); @@ -157,7 +157,7 @@ protected function checkSettingType(ShopConfigurationSetting $value, string $req /** * @throws WrongSettingValueException */ - protected function getArrayFromSettingValue(ShopConfigurationSetting $setting): array + private function getArrayFromSettingValue(ShopConfigurationSetting $setting): array { $value = $setting->getValue(); From 4d22a2d5448976e2cb1a440e90b2eaff29dcb02f Mon Sep 17 00:00:00 2001 From: marcelmanzel Date: Wed, 6 Dec 2023 16:32:01 +0100 Subject: [PATCH 4/5] OXDEV-7647: Move some exception-annotations to the original methods --- src/Setting/Infrastructure/ShopSettingRepository.php | 6 +++--- src/Setting/Infrastructure/ThemeSettingRepository.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Setting/Infrastructure/ShopSettingRepository.php b/src/Setting/Infrastructure/ShopSettingRepository.php index badb8f0..9ce3165 100644 --- a/src/Setting/Infrastructure/ShopSettingRepository.php +++ b/src/Setting/Infrastructure/ShopSettingRepository.php @@ -207,9 +207,6 @@ public function saveAssocCollectionSetting(string $name, array $value): void $this->saveAsType(FieldType::ASSOCIATIVE_ARRAY, $name, $value); } - /** - * @throws WrongSettingTypeException - */ private function saveAsType(string $type, string $name, mixed $value): void { $this->validateOriginalSettingType($name, $type); @@ -223,6 +220,9 @@ private function saveAsType(string $type, string $name, mixed $value): void $this->configurationSettingDao->save($setting); } + /** + * @throws WrongSettingTypeException + */ private function validateOriginalSettingType(string $originalSettingName, string $type): void { $originalSetting = $this->getShopSetting($originalSettingName); diff --git a/src/Setting/Infrastructure/ThemeSettingRepository.php b/src/Setting/Infrastructure/ThemeSettingRepository.php index f26a7f8..ca5a5d2 100644 --- a/src/Setting/Infrastructure/ThemeSettingRepository.php +++ b/src/Setting/Infrastructure/ThemeSettingRepository.php @@ -184,6 +184,9 @@ public function saveAssocCollectionSetting(string $name, array $value, string $t $this->saveSettingAsType(FieldType::ASSOCIATIVE_ARRAY, $name, $themeId, $value); } + /** + * @throws NoSettingsFoundForThemeException + */ protected function getSettingValue(string $name, string $fieldType, string $theme): mixed { $queryBuilder = $this->queryBuilderFactory->create(); @@ -240,9 +243,6 @@ protected function saveSettingValue(string $name, string $themeId, string $value ); } - /** - * @throws NoSettingsFoundForThemeException - */ protected function saveSettingAsType(string $settingType, string $name, string $themeId, mixed $value): void { $this->getSettingValue($name, $settingType, $themeId); From 1f02d607937f59618b10cb2d37da460a21d3cbb7 Mon Sep 17 00:00:00 2001 From: marcelmanzel Date: Wed, 6 Dec 2023 16:32:56 +0100 Subject: [PATCH 5/5] OXDEV-7647: Use logicalOr to assert getSettingValue parameter for theme test --- .../Unit/Infrastructure/ThemeSettingRepositorySettersTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Unit/Infrastructure/ThemeSettingRepositorySettersTest.php b/tests/Unit/Infrastructure/ThemeSettingRepositorySettersTest.php index 9006624..e574ede 100644 --- a/tests/Unit/Infrastructure/ThemeSettingRepositorySettersTest.php +++ b/tests/Unit/Infrastructure/ThemeSettingRepositorySettersTest.php @@ -9,6 +9,7 @@ namespace OxidEsales\GraphQL\ConfigurationAccess\Tests\Unit\Infrastructure; +use OxidEsales\GraphQL\ConfigurationAccess\Setting\Enum\FieldType; use OxidEsales\GraphQL\ConfigurationAccess\Setting\Exception\NoSettingsFoundForThemeException; /** @@ -28,7 +29,7 @@ public function testSetterThrowsExceptionOnNotExistingSetting( $repository = $this->getSut(methods: ['getSettingValue']); $repository->method('getSettingValue') - ->with($name, $this->anything(), $themeId) + ->with($name, $this->logicalOr(...FieldType::getEnums()), $themeId) ->willThrowException(new NoSettingsFoundForThemeException($themeId)); $this->expectException(NoSettingsFoundForThemeException::class);