diff --git a/src/Setting/Controller/ModuleSettingController.php b/src/Setting/Controller/ModuleSettingController.php index 1a8d3dd..e3f4ac5 100644 --- a/src/Setting/Controller/ModuleSettingController.php +++ b/src/Setting/Controller/ModuleSettingController.php @@ -19,7 +19,8 @@ final class ModuleSettingController { public function __construct( private ModuleSettingServiceInterface $settingService - ){} + ) { + } /** * @Query() diff --git a/src/Setting/Controller/ShopSettingController.php b/src/Setting/Controller/ShopSettingController.php index 35c1e74..755a9a6 100644 --- a/src/Setting/Controller/ShopSettingController.php +++ b/src/Setting/Controller/ShopSettingController.php @@ -18,7 +18,8 @@ final class ShopSettingController { public function __construct( private ShopSettingServiceInterface $settingService - ){} + ) { + } /** * @Query() diff --git a/src/Setting/Controller/ThemeSettingController.php b/src/Setting/Controller/ThemeSettingController.php index ff1dc13..911aed1 100644 --- a/src/Setting/Controller/ThemeSettingController.php +++ b/src/Setting/Controller/ThemeSettingController.php @@ -19,7 +19,8 @@ final class ThemeSettingController { public function __construct( private ThemeSettingServiceInterface $settingService - ){} + ) { + } /** * @Query() diff --git a/src/Setting/DataType/BooleanSetting.php b/src/Setting/DataType/BooleanSetting.php index 524602a..f950eb7 100644 --- a/src/Setting/DataType/BooleanSetting.php +++ b/src/Setting/DataType/BooleanSetting.php @@ -21,7 +21,8 @@ final class BooleanSetting public function __construct( private ID $name, private bool $value - ) {} + ) { + } /** * @Field() diff --git a/src/Setting/DataType/FloatSetting.php b/src/Setting/DataType/FloatSetting.php index 88535a1..5aa3bec 100644 --- a/src/Setting/DataType/FloatSetting.php +++ b/src/Setting/DataType/FloatSetting.php @@ -21,7 +21,8 @@ final class FloatSetting public function __construct( private ID $name, private float $value - ) {} + ) { + } /** * @Field() diff --git a/src/Setting/DataType/IntegerSetting.php b/src/Setting/DataType/IntegerSetting.php index 5a458f0..1caf963 100644 --- a/src/Setting/DataType/IntegerSetting.php +++ b/src/Setting/DataType/IntegerSetting.php @@ -21,7 +21,8 @@ final class IntegerSetting public function __construct( private ID $name, private int $value - ) {} + ) { + } /** * @Field() diff --git a/src/Setting/DataType/SettingType.php b/src/Setting/DataType/SettingType.php index d64d690..5022cbb 100644 --- a/src/Setting/DataType/SettingType.php +++ b/src/Setting/DataType/SettingType.php @@ -24,16 +24,15 @@ final class SettingType public function __construct( private ID $name, - String $type + string $type ) { $valid = FieldType::validateFieldType($type); if (!$valid) { - throw new UnexpectedValueException('The value "'.$type.'" is not a valid field type. -Please use one of the following types: "'.implode('", "', FieldType::getEnums()).'".'); + throw new UnexpectedValueException('The value "' . $type . '" is not a valid field type. +Please use one of the following types: "' . implode('", "', FieldType::getEnums()) . '".'); } $this->type = $type; - } /** diff --git a/src/Setting/DataType/StringSetting.php b/src/Setting/DataType/StringSetting.php index 107c2ae..8adbcff 100644 --- a/src/Setting/DataType/StringSetting.php +++ b/src/Setting/DataType/StringSetting.php @@ -21,7 +21,8 @@ final class StringSetting public function __construct( private ID $name, private string $value - ) {} + ) { + } /** * @Field() diff --git a/src/Setting/Enum/FieldType.php b/src/Setting/Enum/FieldType.php index c3f6578..12d5819 100644 --- a/src/Setting/Enum/FieldType.php +++ b/src/Setting/Enum/FieldType.php @@ -9,7 +9,6 @@ namespace OxidEsales\GraphQL\ConfigurationAccess\Setting\Enum; - final class FieldType { public const ASSOCIATIVE_ARRAY = 'aarr'; diff --git a/src/Setting/Infrastructure/AbstractDatabaseSettingRepository.php b/src/Setting/Infrastructure/AbstractDatabaseSettingRepository.php index 6d74298..0ac569b 100644 --- a/src/Setting/Infrastructure/AbstractDatabaseSettingRepository.php +++ b/src/Setting/Infrastructure/AbstractDatabaseSettingRepository.php @@ -36,7 +36,7 @@ protected function isFloatString(string $number): bool protected function getSettingValue(ID $name, string $fieldType, string $theme = ''): string { if ($theme) { - $theme = 'theme:'.$theme; + $theme = 'theme:' . $theme; } $queryBuilder = $this->queryBuilderFactory->create(); @@ -64,7 +64,7 @@ protected function getSettingValue(ID $name, string $fieldType, string $theme = protected function getSettingTypes(string $theme = ''): array { - $themeCondition = (!empty($theme)) ? 'theme:'.$theme : ''; + $themeCondition = (!empty($theme)) ? 'theme:' . $theme : ''; $shopId = $this->basicContext->getCurrentShopId(); $queryBuilder = $this->queryBuilderFactory->create(); @@ -80,9 +80,9 @@ protected function getSettingTypes(string $theme = ''): array $result = $queryBuilder->execute(); $value = $result->fetchAllKeyValue(); - $notFoundLocation = (!empty($theme)) ? 'theme: "'.$theme.'"' : 'shopID: "'.$shopId.'"'; + $notFoundLocation = (!empty($theme)) ? 'theme: "' . $theme . '"' : 'shopID: "' . $shopId . '"'; if ($value === []) { - throw new NotFound('No configurations found for '.$notFoundLocation); + throw new NotFound('No configurations found for ' . $notFoundLocation); } return $value; diff --git a/src/Setting/Infrastructure/ModuleSettingRepository.php b/src/Setting/Infrastructure/ModuleSettingRepository.php index 0828ed9..351a814 100644 --- a/src/Setting/Infrastructure/ModuleSettingRepository.php +++ b/src/Setting/Infrastructure/ModuleSettingRepository.php @@ -25,7 +25,8 @@ public function __construct( private ModuleSettingServiceInterface $moduleSettingService, private ModuleConfigurationDaoInterface $moduleConfigurationDao, private BasicContextInterface $basicContext - ) {} + ) { + } public function getIntegerSetting(ID $name, string $moduleId): IntegerSetting { diff --git a/src/Setting/Service/ModuleSettingService.php b/src/Setting/Service/ModuleSettingService.php index 1448e9b..6263031 100644 --- a/src/Setting/Service/ModuleSettingService.php +++ b/src/Setting/Service/ModuleSettingService.php @@ -23,7 +23,8 @@ final class ModuleSettingService implements ModuleSettingServiceInterface { public function __construct( private ModuleSettingRepositoryInterface $moduleSettingRepository - ) {} + ) { + } public function getIntegerSetting(ID $name, $moduleId): IntegerSetting { @@ -50,35 +51,35 @@ public function getCollectionSetting(ID $name, $moduleId): StringSetting return $this->moduleSettingRepository->getCollectionSetting($name, $moduleId); } - public function changeIntegerSetting(ID $name, int $value, string $moduleId):IntegerSetting + public function changeIntegerSetting(ID $name, int $value, string $moduleId): IntegerSetting { $this->moduleSettingRepository->saveIntegerSetting($name, $value, $moduleId); return new IntegerSetting($name, $value); } - public function changeFloatSetting(ID $name, float $value, string $moduleId):FloatSetting + public function changeFloatSetting(ID $name, float $value, string $moduleId): FloatSetting { $this->moduleSettingRepository->saveFloatSetting($name, $value, $moduleId); return new FloatSetting($name, $value); } - public function changeBooleanSetting(ID $name, bool $value, string $moduleId):BooleanSetting + public function changeBooleanSetting(ID $name, bool $value, string $moduleId): BooleanSetting { $this->moduleSettingRepository->saveBooleanSetting($name, $value, $moduleId); return new BooleanSetting($name, $value); } - public function changeStringSetting(ID $name, string $value, string $moduleId):StringSetting + public function changeStringSetting(ID $name, string $value, string $moduleId): StringSetting { $this->moduleSettingRepository->saveStringSetting($name, $value, $moduleId); return new StringSetting($name, $value); } - public function changeCollectionSetting(ID $name, string $value, string $moduleId):StringSetting + public function changeCollectionSetting(ID $name, string $value, string $moduleId): StringSetting { $arrayValue = json_decode($value, true); diff --git a/src/Setting/Service/ShopSettingService.php b/src/Setting/Service/ShopSettingService.php index ddc7e7a..ac614c0 100644 --- a/src/Setting/Service/ShopSettingService.php +++ b/src/Setting/Service/ShopSettingService.php @@ -21,7 +21,8 @@ final class ShopSettingService implements ShopSettingServiceInterface { public function __construct( private ShopSettingRepositoryInterface $shopSettingRepository - ) {} + ) { + } public function getIntegerSetting(ID $name): IntegerSetting { diff --git a/src/Setting/Service/ThemeSettingService.php b/src/Setting/Service/ThemeSettingService.php index f032b25..9617062 100644 --- a/src/Setting/Service/ThemeSettingService.php +++ b/src/Setting/Service/ThemeSettingService.php @@ -22,7 +22,8 @@ final class ThemeSettingService implements ThemeSettingServiceInterface { public function __construct( private ThemeSettingRepositoryInterface $themeSettingRepository - ) {} + ) { + } public function getIntegerSetting(ID $name, string $themeId): IntegerSetting { diff --git a/src/Shared/Service/NamespaceMapper.php b/src/Shared/Service/NamespaceMapper.php index 593ce21..2269320 100644 --- a/src/Shared/Service/NamespaceMapper.php +++ b/src/Shared/Service/NamespaceMapper.php @@ -13,7 +13,6 @@ final class NamespaceMapper implements NamespaceMapperInterface { - private const SPACE = '\\OxidEsales\\GraphQL\\ConfigurationAccess\\'; public function getControllerNamespaceMapping(): array diff --git a/tests/Codeception/Acceptance/ModuleSettingCest.php b/tests/Codeception/Acceptance/ModuleSettingCest.php index c8ea5cb..e0b0502 100644 --- a/tests/Codeception/Acceptance/ModuleSettingCest.php +++ b/tests/Codeception/Acceptance/ModuleSettingCest.php @@ -26,7 +26,6 @@ */ final class ModuleSettingCest extends BaseCest { - public function _before(AcceptanceTester $I): void { $this->prepareConfiguration(); @@ -44,7 +43,7 @@ public function testGetIntegerSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - moduleSettingInteger(name: "intSetting", moduleId: "'.$this->getTestModuleName().'") { + moduleSettingInteger(name: "intSetting", moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -64,7 +63,7 @@ public function testGetIntegerSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - moduleSettingInteger(name: "intSetting", moduleId: "'.$this->getTestModuleName().'") { + moduleSettingInteger(name: "intSetting", moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -87,7 +86,7 @@ public function testGetFloatSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - moduleSettingFloat(name: "floatSetting", moduleId: "'.$this->getTestModuleName().'") { + moduleSettingFloat(name: "floatSetting", moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -107,7 +106,7 @@ public function testGetFloatSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - moduleSettingFloat(name: "floatSetting", moduleId: "'.$this->getTestModuleName().'") { + moduleSettingFloat(name: "floatSetting", moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -130,7 +129,7 @@ public function testGetBooleanSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - moduleSettingBoolean(name: "boolSetting", moduleId: "'.$this->getTestModuleName().'") { + moduleSettingBoolean(name: "boolSetting", moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -150,7 +149,7 @@ public function testGetBooleanSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - moduleSettingBoolean(name: "boolSetting", moduleId: "'.$this->getTestModuleName().'") { + moduleSettingBoolean(name: "boolSetting", moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -173,7 +172,7 @@ public function testGetStringSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - moduleSettingString(name: "stringSetting", moduleId: "'.$this->getTestModuleName().'") { + moduleSettingString(name: "stringSetting", moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -193,7 +192,7 @@ public function testGetStringSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - moduleSettingString(name: "stringSetting", moduleId: "'.$this->getTestModuleName().'") { + moduleSettingString(name: "stringSetting", moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -216,7 +215,7 @@ public function testGetCollectionSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - moduleSettingCollection(name: "arraySetting", moduleId: "'.$this->getTestModuleName().'") { + moduleSettingCollection(name: "arraySetting", moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -236,7 +235,7 @@ public function testGetCollectionSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - moduleSettingCollection(name: "arraySetting", moduleId: "'.$this->getTestModuleName().'") { + moduleSettingCollection(name: "arraySetting", moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -259,7 +258,7 @@ public function testChangeIntegerSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeModuleSettingInteger(name: "intSetting", value: 124, moduleId: "'.$this->getTestModuleName().'") { + changeModuleSettingInteger(name: "intSetting", value: 124, moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -279,7 +278,7 @@ public function testChangeIntegerSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeModuleSettingInteger(name: "intSetting", value: 124, moduleId: "'.$this->getTestModuleName().'") { + changeModuleSettingInteger(name: "intSetting", value: 124, moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -302,7 +301,7 @@ public function testChangeFloatSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeModuleSettingFloat(name: "floatSetting", value: 1.24, moduleId: "'.$this->getTestModuleName().'") { + changeModuleSettingFloat(name: "floatSetting", value: 1.24, moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -322,7 +321,7 @@ public function testChangeFloatSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeModuleSettingFloat(name: "floatSetting", value: 1.24, moduleId: "'.$this->getTestModuleName().'") { + changeModuleSettingFloat(name: "floatSetting", value: 1.24, moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -345,7 +344,8 @@ public function testChangeBooleanSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeModuleSettingBoolean(name: "boolSetting", value: False, moduleId: "'.$this->getTestModuleName().'") { + changeModuleSettingBoolean(name: "boolSetting", value: False, moduleId: "' . $this->getTestModuleName( + ) . '") { name value } @@ -365,7 +365,8 @@ public function testChangeBooleanSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeModuleSettingBoolean(name: "boolSetting", value: false, moduleId: "'.$this->getTestModuleName().'") { + changeModuleSettingBoolean(name: "boolSetting", value: false, moduleId: "' . $this->getTestModuleName( + ) . '") { name value } @@ -388,7 +389,8 @@ public function testChangeStringSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeModuleSettingString(name: "stringSetting", value: "default", moduleId: "'.$this->getTestModuleName().'") { + changeModuleSettingString(name: "stringSetting", value: "default", moduleId: "' . $this->getTestModuleName( + ) . '") { name value } @@ -408,7 +410,8 @@ public function testChangeStringSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeModuleSettingString(name: "stringSetting", value: "default", moduleId: "'.$this->getTestModuleName().'") { + changeModuleSettingString(name: "stringSetting", value: "default", moduleId: "' . $this->getTestModuleName( + ) . '") { name value } @@ -431,7 +434,7 @@ public function testChangeCollectionSettingNotAuthorized(AcceptanceTester $I): v $I->sendGQLQuery( 'mutation{ - changeModuleSettingCollection(name: "arraySetting", moduleId: "'.$this->getTestModuleName().'") { + changeModuleSettingCollection(name: "arraySetting", moduleId: "' . $this->getTestModuleName() . '") { name value } @@ -474,7 +477,7 @@ public function testGetModuleSettingsListNotAuthorized(AcceptanceTester $I): voi $I->sendGQLQuery( 'query{ - moduleSettingsList(moduleId: "'.$this->getTestModuleName().'") { + moduleSettingsList(moduleId: "' . $this->getTestModuleName() . '") { name type } @@ -494,7 +497,7 @@ public function testGetModuleSettingsListAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - moduleSettingsList(moduleId: "'.$this->getTestModuleName().'") { + moduleSettingsList(moduleId: "' . $this->getTestModuleName() . '") { name type } @@ -508,11 +511,11 @@ public function testGetModuleSettingsListAuthorized(AcceptanceTester $I): void $settingsList = $result['data']['moduleSettingsList']; $I->assertCount(5, $settingsList); - $I->assertContains(['name'=>'intSetting', 'type'=>FieldType::NUMBER], $settingsList); - $I->assertContains(['name'=>'floatSetting', 'type'=>FieldType::NUMBER], $settingsList); - $I->assertContains(['name'=>'boolSetting', 'type'=>FieldType::BOOLEAN], $settingsList); - $I->assertContains(['name'=>'stringSetting', 'type'=>FieldType::STRING], $settingsList); - $I->assertContains(['name'=>'arraySetting', 'type'=>FieldType::ARRAY], $settingsList); + $I->assertContains(['name' => 'intSetting', 'type' => FieldType::NUMBER], $settingsList); + $I->assertContains(['name' => 'floatSetting', 'type' => FieldType::NUMBER], $settingsList); + $I->assertContains(['name' => 'boolSetting', 'type' => FieldType::BOOLEAN], $settingsList); + $I->assertContains(['name' => 'stringSetting', 'type' => FieldType::STRING], $settingsList); + $I->assertContains(['name' => 'arraySetting', 'type' => FieldType::ARRAY], $settingsList); } private function prepareConfiguration(): void @@ -561,14 +564,13 @@ private function prepareConfiguration(): void ->addModuleSetting($collectionSetting); $shopConfiguration->addModuleConfiguration($moduleConfiguration); - $this->getShopConfigurationDao()->save($shopConfiguration,1); + $this->getShopConfigurationDao()->save($shopConfiguration, 1); } private function removeConfiguration(string $moduleId): void { $shopConfiguration = $this->getShopConfiguration(); $shopConfiguration->deleteModuleConfiguration($moduleId); - } private function getShopConfiguration(): ShopConfiguration diff --git a/tests/Codeception/Acceptance/ShopSettingCest.php b/tests/Codeception/Acceptance/ShopSettingCest.php index 448e65f..bb4d703 100644 --- a/tests/Codeception/Acceptance/ShopSettingCest.php +++ b/tests/Codeception/Acceptance/ShopSettingCest.php @@ -361,12 +361,12 @@ public function testGetShopSettingsListAuthorized(AcceptanceTester $I): void $settingsList = $result['data']['shopSettingsList']; $I->assertCount(7, $settingsList); - $I->assertContains(['name'=>'intSetting', 'type' => FieldType::NUMBER], $settingsList); - $I->assertContains(['name'=>'floatSetting', 'type' => FieldType::NUMBER], $settingsList); - $I->assertContains(['name'=>'boolSetting', 'type' =>FieldType::BOOLEAN], $settingsList); - $I->assertContains(['name'=>'stringSetting', 'type' => FieldType::STRING], $settingsList); - $I->assertContains(['name'=>'selectSetting', 'type' => FieldType::SELECT], $settingsList); - $I->assertContains(['name'=>'arraySetting', 'type' => FieldType::ARRAY], $settingsList); - $I->assertContains(['name'=>'aarraySetting', 'type' => FieldType::ASSOCIATIVE_ARRAY], $settingsList); + $I->assertContains(['name' => 'intSetting', 'type' => FieldType::NUMBER], $settingsList); + $I->assertContains(['name' => 'floatSetting', 'type' => FieldType::NUMBER], $settingsList); + $I->assertContains(['name' => 'boolSetting', 'type' => FieldType::BOOLEAN], $settingsList); + $I->assertContains(['name' => 'stringSetting', 'type' => FieldType::STRING], $settingsList); + $I->assertContains(['name' => 'selectSetting', 'type' => FieldType::SELECT], $settingsList); + $I->assertContains(['name' => 'arraySetting', 'type' => FieldType::ARRAY], $settingsList); + $I->assertContains(['name' => 'aarraySetting', 'type' => FieldType::ASSOCIATIVE_ARRAY], $settingsList); } } diff --git a/tests/Codeception/Acceptance/ThemeSettingCest.php b/tests/Codeception/Acceptance/ThemeSettingCest.php index 9c35736..91594fd 100644 --- a/tests/Codeception/Acceptance/ThemeSettingCest.php +++ b/tests/Codeception/Acceptance/ThemeSettingCest.php @@ -26,7 +26,7 @@ public function testGetIntegerSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingInteger(name: "intSetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingInteger(name: "intSetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -46,7 +46,7 @@ public function testGetIntegerSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingInteger(name: "intSetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingInteger(name: "intSetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -69,7 +69,7 @@ public function testGetFloatSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingFloat(name: "floatSetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingFloat(name: "floatSetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -89,7 +89,7 @@ public function testGetFloatSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingFloat(name: "floatSetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingFloat(name: "floatSetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -112,7 +112,7 @@ public function testGetBooleanSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingBoolean(name: "boolSetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingBoolean(name: "boolSetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -132,7 +132,7 @@ public function testGetBooleanSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingBoolean(name: "boolSetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingBoolean(name: "boolSetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -155,7 +155,7 @@ public function testGetStringSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingString(name: "stringSetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingString(name: "stringSetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -175,7 +175,7 @@ public function testGetStringSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingString(name: "stringSetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingString(name: "stringSetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -198,7 +198,7 @@ public function testGetSelectSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingSelect(name: "selectSetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingSelect(name: "selectSetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -218,7 +218,7 @@ public function testGetSelectSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingSelect(name: "selectSetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingSelect(name: "selectSetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -241,7 +241,7 @@ public function testGetCollectionSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingCollection(name: "arraySetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingCollection(name: "arraySetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -261,7 +261,7 @@ public function testGetCollectionSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingCollection(name: "arraySetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingCollection(name: "arraySetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -284,7 +284,7 @@ public function testGetAssocCollectionSettingNotAuthorized(AcceptanceTester $I): $I->sendGQLQuery( 'query{ - themeSettingAssocCollection(name: "aarraySetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingAssocCollection(name: "aarraySetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -304,7 +304,7 @@ public function testGetAssocCollectionSettingAuthorized(AcceptanceTester $I): vo $I->sendGQLQuery( 'query{ - themeSettingAssocCollection(name: "aarraySetting", themeId: "'.$this->getTestThemeName().'") { + themeSettingAssocCollection(name: "aarraySetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -327,7 +327,7 @@ public function testGetThemeSettingsListNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingsList(themeId: "'.$this->getTestThemeName().'") { + themeSettingsList(themeId: "' . $this->getTestThemeName() . '") { name type } @@ -347,7 +347,7 @@ public function testGetThemeSettingsListAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'query{ - themeSettingsList(themeId: "'.$this->getTestThemeName().'") { + themeSettingsList(themeId: "' . $this->getTestThemeName() . '") { name type } @@ -361,13 +361,13 @@ public function testGetThemeSettingsListAuthorized(AcceptanceTester $I): void $settingsList = $result['data']['themeSettingsList']; $I->assertCount(7, $settingsList); - $I->assertContains(['name'=>'intSetting', 'type' => FieldType::NUMBER], $settingsList); - $I->assertContains(['name'=>'floatSetting', 'type' => FieldType::NUMBER], $settingsList); - $I->assertContains(['name'=>'boolSetting', 'type' =>FieldType::BOOLEAN], $settingsList); - $I->assertContains(['name'=>'stringSetting', 'type' => FieldType::STRING], $settingsList); - $I->assertContains(['name'=>'selectSetting', 'type' => FieldType::SELECT], $settingsList); - $I->assertContains(['name'=>'arraySetting', 'type' => FieldType::ARRAY], $settingsList); - $I->assertContains(['name'=>'aarraySetting', 'type' => FieldType::ASSOCIATIVE_ARRAY], $settingsList); + $I->assertContains(['name' => 'intSetting', 'type' => FieldType::NUMBER], $settingsList); + $I->assertContains(['name' => 'floatSetting', 'type' => FieldType::NUMBER], $settingsList); + $I->assertContains(['name' => 'boolSetting', 'type' => FieldType::BOOLEAN], $settingsList); + $I->assertContains(['name' => 'stringSetting', 'type' => FieldType::STRING], $settingsList); + $I->assertContains(['name' => 'selectSetting', 'type' => FieldType::SELECT], $settingsList); + $I->assertContains(['name' => 'arraySetting', 'type' => FieldType::ARRAY], $settingsList); + $I->assertContains(['name' => 'aarraySetting', 'type' => FieldType::ASSOCIATIVE_ARRAY], $settingsList); } public function testChangeIntegerSettingNotAuthorized(AcceptanceTester $I): void @@ -376,7 +376,8 @@ public function testChangeIntegerSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeThemeSettingInteger(name: "intSettingEditable", value: 124, themeId: "'.$this->getTestThemeName().'") { + changeThemeSettingInteger(name: "intSettingEditable", value: 124, themeId: "' . $this->getTestThemeName( + ) . '") { name value } @@ -396,7 +397,8 @@ public function testChangeIntegerSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeThemeSettingInteger(name: "intSettingEditable", value: 124, themeId: "'.$this->getTestThemeName().'") { + changeThemeSettingInteger(name: "intSettingEditable", value: 124, themeId: "' . $this->getTestThemeName( + ) . '") { name value } @@ -419,7 +421,8 @@ public function testChangeFloatSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeThemeSettingFloat(name: "floatSettingEditable", value: 1.24, themeId: "'.$this->getTestThemeName().'") { + changeThemeSettingFloat(name: "floatSettingEditable", value: 1.24, themeId: "' . $this->getTestThemeName( + ) . '") { name value } @@ -439,7 +442,8 @@ public function testChangeFloatSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeThemeSettingFloat(name: "floatSettingEditable", value: 1.24, themeId: "'.$this->getTestThemeName().'") { + changeThemeSettingFloat(name: "floatSettingEditable", value: 1.24, themeId: "' . $this->getTestThemeName( + ) . '") { name value } @@ -462,7 +466,8 @@ public function testChangeBooleanSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeThemeSettingBoolean(name: "boolSettingEditable", value: False, themeId: "'.$this->getTestThemeName().'") { + changeThemeSettingBoolean(name: "boolSettingEditable", value: False, themeId: "' . $this->getTestThemeName( + ) . '") { name value } @@ -482,7 +487,8 @@ public function testChangeBooleanSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeThemeSettingBoolean(name: "boolSettingEditable", value: true, themeId: "'.$this->getTestThemeName().'") { + changeThemeSettingBoolean(name: "boolSettingEditable", value: true, themeId: "' . $this->getTestThemeName( + ) . '") { name value } @@ -505,7 +511,8 @@ public function testChangeStringSettingNotAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeThemeSettingString(name: "stringSettingEditable", value: "default", themeId: "'.$this->getTestThemeName().'") { + changeThemeSettingString(name: "stringSettingEditable", value: "default", themeId: "' . $this->getTestThemeName( + ) . '") { name value } @@ -525,7 +532,8 @@ public function testChangeStringSettingAuthorized(AcceptanceTester $I): void $I->sendGQLQuery( 'mutation{ - changeThemeSettingString(name: "stringSetting", value: "default", themeId: "'.$this->getTestThemeName().'") { + changeThemeSettingString(name: "stringSetting", value: "default", themeId: "' . $this->getTestThemeName( + ) . '") { name value } @@ -548,7 +556,7 @@ public function testChangeCollectionSettingNotAuthorized(AcceptanceTester $I): v $I->sendGQLQuery( 'mutation{ - changeThemeSettingCollection(name: "arraySetting", themeId: "'.$this->getTestThemeName().'") { + changeThemeSettingCollection(name: "arraySetting", themeId: "' . $this->getTestThemeName() . '") { name value } @@ -584,5 +592,4 @@ public function testChangeCollectionSettingAuthorized(AcceptanceTester $I): void $I->assertSame('arraySetting', $setting['name']); $I->assertSame('[3, "interesting", "values"]', $setting['value']); } - } diff --git a/tests/Codeception/Config/params.php b/tests/Codeception/Config/params.php index a943ef2..13f8241 100644 --- a/tests/Codeception/Config/params.php +++ b/tests/Codeception/Config/params.php @@ -7,9 +7,9 @@ declare(strict_types=1); +use OxidEsales\Codeception\Module\Database\DatabaseDefaultsFileGenerator; use OxidEsales\Facts\Config\ConfigFile; use OxidEsales\Facts\Facts; -use OxidEsales\Codeception\Module\Database\DatabaseDefaultsFileGenerator; use Symfony\Component\Filesystem\Path; $facts = new Facts(); diff --git a/tests/Codeception/acceptance.suite.yml b/tests/Codeception/acceptance.suite.yml index 02e2dd2..321e415 100644 --- a/tests/Codeception/acceptance.suite.yml +++ b/tests/Codeception/acceptance.suite.yml @@ -4,40 +4,40 @@ path: Acceptance bootstrap: _bootstrap.php modules: - enabled: - - Asserts - - \OxidEsales\Codeception\Module\ShopSetup: - dump: '%DUMP_PATH%' - fixtures: '%FIXTURES_PATH%' - license: '%license_key%' - - Db: - dsn: 'mysql:host=%DB_HOST%;dbname=%DB_NAME%;charset=utf8' - user: '%DB_USERNAME%' - password: '%DB_PASSWORD%' - port: '%DB_PORT%' - module_dump: '%MODULE_DUMP_PATH%' - mysql_config: '%MYSQL_CONFIG_PATH%' - populate: true # run populator before all tests - cleanup: false # run populator before each test - populator: > - mysql --defaults-file=$mysql_config --default-character-set=utf8 $dbname < $module_dump - - \OxidEsales\Codeception\Module\Database: - config_key: 'fq45QS09_fqyx09239QQ' - depends: Db - - \OxidEsales\Codeception\Module\SelectTheme: - theme_id: '%THEME_ID%' - depends: - - \OxidEsales\Codeception\Module\Database - - Db - - REST: - url: '%SHOP_URL%' - depends: PhpBrowser - part: Json - - PhpBrowser: - url: '%SHOP_URL%' - - \OxidEsales\GraphQL\Base\Tests\Codeception\Module\AcceptanceHelper: - depends: - - REST - - \OxidEsales\Codeception\Module\OxideshopModules + enabled: + - Asserts + - \OxidEsales\Codeception\Module\ShopSetup: + dump: '%DUMP_PATH%' + fixtures: '%FIXTURES_PATH%' + license: '%license_key%' + - Db: + dsn: 'mysql:host=%DB_HOST%;dbname=%DB_NAME%;charset=utf8' + user: '%DB_USERNAME%' + password: '%DB_PASSWORD%' + port: '%DB_PORT%' + module_dump: '%MODULE_DUMP_PATH%' + mysql_config: '%MYSQL_CONFIG_PATH%' + populate: true # run populator before all tests + cleanup: false # run populator before each test + populator: > + mysql --defaults-file=$mysql_config --default-character-set=utf8 $dbname < $module_dump + - \OxidEsales\Codeception\Module\Database: + config_key: 'fq45QS09_fqyx09239QQ' + depends: Db + - \OxidEsales\Codeception\Module\SelectTheme: + theme_id: '%THEME_ID%' + depends: + - \OxidEsales\Codeception\Module\Database + - Db + - REST: + url: '%SHOP_URL%' + depends: PhpBrowser + part: Json + - PhpBrowser: + url: '%SHOP_URL%' + - \OxidEsales\GraphQL\Base\Tests\Codeception\Module\AcceptanceHelper: + depends: + - REST + - \OxidEsales\Codeception\Module\OxideshopModules step_decorators: - - \Codeception\Step\Retry + - \Codeception\Step\Retry diff --git a/tests/Integration/Infrastructure/ThemeSettingRepositoryTest.php b/tests/Integration/Infrastructure/ThemeSettingRepositoryTest.php index e0a1c7e..d961baf 100644 --- a/tests/Integration/Infrastructure/ThemeSettingRepositoryTest.php +++ b/tests/Integration/Infrastructure/ThemeSettingRepositoryTest.php @@ -25,7 +25,10 @@ public function testSaveAndGetIntegerSetting(): void { $container = ContainerFactory::getInstance()->getContainer(); $configurationChangedEvent = new ThemeSettingChangedEvent( - "coolIntSetting", 1, 'awesomeTheme'); + "coolIntSetting", + 1, + 'awesomeTheme' + ); $eventDispatcher = $this->createMock(EventDispatcherInterface::class); $eventDispatcher->expects($this->once()) ->method('dispatch') @@ -61,7 +64,7 @@ public function testSaveAndGetIntegerSetting(): void $queryBuilder->execute(); $repository->saveIntegerSetting(new ID('coolIntSetting'), 124, 'awesomeTheme'); - $integerResult = $repository->getInteger(new ID ('coolIntSetting'), 'awesomeTheme'); + $integerResult = $repository->getInteger(new ID('coolIntSetting'), 'awesomeTheme'); $this->assertSame(124, $integerResult); } diff --git a/tests/Unit/Controller/ThemeSettingControllerTest.php b/tests/Unit/Controller/ThemeSettingControllerTest.php index f240d4f..9bd6de9 100644 --- a/tests/Unit/Controller/ThemeSettingControllerTest.php +++ b/tests/Unit/Controller/ThemeSettingControllerTest.php @@ -263,7 +263,11 @@ public function testChangeThemeSettingAssocCollection(): void $nameID = $serviceAssocCollectionSetting->getName(); $value = $serviceAssocCollectionSetting->getValue(); - $assocCollectionSetting = $settingController->changeThemeSettingAssocCollection($nameID, $value, 'awesomeTheme'); + $assocCollectionSetting = $settingController->changeThemeSettingAssocCollection( + $nameID, + $value, + 'awesomeTheme' + ); $this->assertSame($assocCollectionSetting, $serviceAssocCollectionSetting); } diff --git a/tests/Unit/DataType/SettingTest.php b/tests/Unit/DataType/SettingTest.php index e99e867..0b6fad4 100644 --- a/tests/Unit/DataType/SettingTest.php +++ b/tests/Unit/DataType/SettingTest.php @@ -55,15 +55,16 @@ public function testSettingType(): void $settingType = $this->getSettingType(); $this->assertEquals(new ID('settingType'), $settingType->getName()); - $this->assertSame( FieldType::BOOLEAN, $settingType->getType() - ); + $this->assertSame(FieldType::BOOLEAN, $settingType->getType()); } public function testInvalidSettingType(): void { $this->expectException(UnexpectedValueException::class); - $this->expectExceptionMessage('The value "invalidType" is not a valid field type. -Please use one of the following types: "'.implode('", "', FieldType::getEnums()).'".'); + $this->expectExceptionMessage( + 'The value "invalidType" is not a valid field type. +Please use one of the following types: "' . implode('", "', FieldType::getEnums()) . '".' + ); new SettingType(new ID('coolSettingType'), 'invalidType'); } diff --git a/tests/Unit/Infrastructure/ModuleSettingRepositoryTest.php b/tests/Unit/Infrastructure/ModuleSettingRepositoryTest.php index f28c420..3035a26 100644 --- a/tests/Unit/Infrastructure/ModuleSettingRepositoryTest.php +++ b/tests/Unit/Infrastructure/ModuleSettingRepositoryTest.php @@ -253,5 +253,4 @@ public function getModuleSettingRepository( $basicContext = $this->createMock(BasicContextInterface::class); return new ModuleSettingRepository($moduleSettingService, $moduleConfigurationDao, $basicContext); } - } diff --git a/tests/Unit/Infrastructure/ShopSettingRepositoryTest.php b/tests/Unit/Infrastructure/ShopSettingRepositoryTest.php index 6c3b1f6..8572eb0 100644 --- a/tests/Unit/Infrastructure/ShopSettingRepositoryTest.php +++ b/tests/Unit/Infrastructure/ShopSettingRepositoryTest.php @@ -5,7 +5,6 @@ use Doctrine\DBAL\ForwardCompatibility\Result; use Doctrine\DBAL\Query\QueryBuilder; use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface; -use OxidEsales\EshopCommunity\Internal\Transition\Utility\BasicContextInterface; use OxidEsales\GraphQL\Base\Exception\NotFound; use OxidEsales\GraphQL\ConfigurationAccess\Setting\Infrastructure\ShopSettingRepository; use OxidEsales\GraphQL\ConfigurationAccess\Setting\Infrastructure\ShopSettingRepositoryInterface; @@ -33,7 +32,7 @@ public function testGetNoShopSettingInteger(): void { $nameID = new ID('NotExistingSetting'); - $repository = $this->getFetchOneShopSettingRepoInstance(False); + $repository = $this->getFetchOneShopSettingRepoInstance(false); $this->expectException(NotFound::class); $this->expectExceptionMessage('The queried name couldn\'t be found as an integer configuration'); @@ -67,7 +66,7 @@ public function testGetNoShopSettingFloat(): void { $nameID = new ID('NotExistingSetting'); - $repository = $this->getFetchOneShopSettingRepoInstance(False); + $repository = $this->getFetchOneShopSettingRepoInstance(false); $this->expectException(NotFound::class); $this->expectExceptionMessage('The queried name couldn\'t be found as a float configuration'); @@ -94,7 +93,7 @@ public function testGetShopSettingBooleanNegativ(): void $boolean = $repository->getBoolean($nameID); - $this->assertEquals(False, $boolean); + $this->assertEquals(false, $boolean); } public function testGetShopSettingBooleanPositiv(): void @@ -113,7 +112,7 @@ public function testGetNoShopSettingBoolean(): void { $nameID = new ID('NotExistingSetting'); - $repository = $this->getFetchOneShopSettingRepoInstance(False); + $repository = $this->getFetchOneShopSettingRepoInstance(false); $this->expectException(NotFound::class); $this->expectExceptionMessage('The queried name couldn\'t be found as a boolean configuration'); @@ -136,7 +135,7 @@ public function testGetNoShopSettingString(): void { $nameID = new ID('NotExistingSetting'); - $repository = $this->getFetchOneShopSettingRepoInstance(False); + $repository = $this->getFetchOneShopSettingRepoInstance(false); $this->expectException(NotFound::class); $this->expectExceptionMessage('The queried name couldn\'t be found as a string configuration'); @@ -159,7 +158,7 @@ public function testGetNoShopSettingSelect(): void { $nameID = new ID('NotExistingSetting'); - $repository = $this->getFetchOneShopSettingRepoInstance(False); + $repository = $this->getFetchOneShopSettingRepoInstance(false); $this->expectException(NotFound::class); $this->expectExceptionMessage('The queried name couldn\'t be found as a select configuration'); @@ -182,7 +181,7 @@ public function testGetNoShopSettingCollection(): void { $nameID = new ID('NotExistingSetting'); - $repository = $this->getFetchOneShopSettingRepoInstance(False); + $repository = $this->getFetchOneShopSettingRepoInstance(false); $this->expectException(NotFound::class); $this->expectExceptionMessage('The queried name couldn\'t be found as a collection configuration'); @@ -199,14 +198,14 @@ public function testGetShopSettingAssocCollection(): void $assocCollection = $repository->getAssocCollection($nameID); - $this->assertEquals(['first'=>'10','second'=>'20','third'=>'50'], $assocCollection); + $this->assertEquals(['first' => '10', 'second' => '20', 'third' => '50'], $assocCollection); } public function testGetNoShopSettingAssocCollection(): void { $nameID = new ID('NotExistingSetting'); - $repository = $this->getFetchOneShopSettingRepoInstance(False); + $repository = $this->getFetchOneShopSettingRepoInstance(false); $this->expectException(NotFound::class); $this->expectExceptionMessage('The queried name couldn\'t be found as an associative collection configuration'); @@ -231,8 +230,8 @@ public function testGetNoSettingsList(): void * @param string|bool $returnedValue * @return QueryBuilderFactoryInterface|(QueryBuilderFactoryInterface&MockObject)|MockObject */ - private function getFetchOneQueryBuilderFactoryMock(string|bool $returnedValue): QueryBuilderFactoryInterface|MockObject - { + private function getFetchOneQueryBuilderFactoryMock(string|bool $returnedValue + ): QueryBuilderFactoryInterface|MockObject { $result = $this->createMock(Result::class); $result->expects($this->once()) ->method('fetchOne') @@ -244,7 +243,8 @@ private function getFetchOneQueryBuilderFactoryMock(string|bool $returnedValue): * @param Result|MockObject|(Result&MockObject) $result * @return QueryBuilderFactoryInterface|(QueryBuilderFactoryInterface&MockObject)|MockObject */ - public function getQueryBuilderFactoryMock(Result|MockObject $result): QueryBuilderFactoryInterface|MockObject { + public function getQueryBuilderFactoryMock(Result|MockObject $result): QueryBuilderFactoryInterface|MockObject + { $queryBuilder = $this->createPartialMock(QueryBuilder::class, ['execute']); $queryBuilder->expects($this->once()) ->method('execute') diff --git a/tests/Unit/Infrastructure/ThemeSettingRepositoryTest.php b/tests/Unit/Infrastructure/ThemeSettingRepositoryTest.php index 6c8a930..023894f 100644 --- a/tests/Unit/Infrastructure/ThemeSettingRepositoryTest.php +++ b/tests/Unit/Infrastructure/ThemeSettingRepositoryTest.php @@ -46,6 +46,7 @@ public function testGetThemeSettingInvalidInteger(): void $this->expectExceptionMessage('The queried configuration was found as a float, not an integer'); $repository->getInteger($nameID, 'awesomeModule'); } + public function testGetThemeSettingFloat(): void { $nameID = new ID('floatSetting'); @@ -84,7 +85,7 @@ public function testGetThemeSettingBooleanNegative(): void $boolean = $repository->getBoolean($nameID, 'awesomeModule'); - $this->assertEquals(False, $boolean); + $this->assertEquals(false, $boolean); } public function testGetThemeSettingBooleanPositive(): void @@ -176,7 +177,7 @@ public function testGetThemeSettingAssocCollection(): void $assocCollection = $repository->getAssocCollection($nameID, 'awesomeModule'); - $this->assertEquals(['first'=>'10','second'=>'20','third'=>'50'], $assocCollection); + $this->assertEquals(['first' => '10', 'second' => '20', 'third' => '50'], $assocCollection); } public function testGetNoThemeSettingAssocCollection(): void @@ -227,8 +228,8 @@ public function testGetNoSettingsList(): void * @param string|bool $returnedValue * @return QueryBuilderFactoryInterface|(QueryBuilderFactoryInterface&MockObject)|MockObject */ - private function getFetchOneQueryBuilderFactoryMock(string|bool $returnedValue): QueryBuilderFactoryInterface|MockObject - { + private function getFetchOneQueryBuilderFactoryMock(string|bool $returnedValue + ): QueryBuilderFactoryInterface|MockObject { $result = $this->createMock(Result::class); $result->expects($this->once()) ->method('fetchOne') @@ -240,8 +241,8 @@ private function getFetchOneQueryBuilderFactoryMock(string|bool $returnedValue): * @param Result|MockObject|(Result&MockObject) $result * @return QueryBuilderFactoryInterface|(QueryBuilderFactoryInterface&MockObject)|MockObject */ - private function getQueryBuilderFactoryMock(Result|MockObject $result - ): QueryBuilderFactoryInterface|MockObject { + private function getQueryBuilderFactoryMock(Result|MockObject $result): QueryBuilderFactoryInterface|MockObject + { $queryBuilder = $this->createPartialMock(QueryBuilder::class, ['execute']); $queryBuilder->expects($this->once()) ->method('execute') diff --git a/tests/Unit/Service/ShopSettingServiceTest.php b/tests/Unit/Service/ShopSettingServiceTest.php index 0cfbe1c..a4bf5ad 100644 --- a/tests/Unit/Service/ShopSettingServiceTest.php +++ b/tests/Unit/Service/ShopSettingServiceTest.php @@ -51,7 +51,7 @@ public function testGetShopSettingBoolean(): void $repository = $this->createMock(ShopSettingRepositoryInterface::class); $repository->expects($this->once()) ->method('getBoolean') - ->willReturn(False); + ->willReturn(false); $settingService = new ShopSettingService($repository); @@ -119,7 +119,7 @@ public function testGetShopSettingAssocCollection(): void $repository = $this->createMock(ShopSettingRepositoryInterface::class); $repository->expects($this->once()) ->method('getAssocCollection') - ->willReturn(['first'=>'10','second'=>'20','third'=>'50']); + ->willReturn(['first' => '10', 'second' => '20', 'third' => '50']); $settingService = new ShopSettingService($repository); diff --git a/tests/Unit/Service/ThemeSettingServiceTest.php b/tests/Unit/Service/ThemeSettingServiceTest.php index 235a8b9..87a6fcc 100644 --- a/tests/Unit/Service/ThemeSettingServiceTest.php +++ b/tests/Unit/Service/ThemeSettingServiceTest.php @@ -52,7 +52,7 @@ public function testGetThemeSettingBoolean(): void $repository = $this->createMock(ThemeSettingRepositoryInterface::class); $repository->expects($this->once()) ->method('getBoolean') - ->willReturn(False); + ->willReturn(false); $settingService = new ThemeSettingService($repository); @@ -120,7 +120,7 @@ public function testGetThemeSettingAssocCollection(): void $repository = $this->createMock(ThemeSettingRepositoryInterface::class); $repository->expects($this->once()) ->method('getAssocCollection') - ->willReturn(['first'=>'10','second'=>'20','third'=>'50']); + ->willReturn(['first' => '10', 'second' => '20', 'third' => '50']); $settingService = new ThemeSettingService($repository); diff --git a/tests/Unit/UnitTestCase.php b/tests/Unit/UnitTestCase.php index a0e8dd2..a47a873 100644 --- a/tests/Unit/UnitTestCase.php +++ b/tests/Unit/UnitTestCase.php @@ -52,8 +52,11 @@ protected function getCollectionSetting(): StringSetting protected function getAssocCollectionSetting(): StringSetting { - return new StringSetting(new ID('aarraySetting'), json_encode( - ['first'=>'10','second'=>'20','third'=>'50'])); + return new StringSetting( + new ID('aarraySetting'), json_encode( + ['first' => '10', 'second' => '20', 'third' => '50'] + ) + ); } protected function getSettingType(): SettingType diff --git a/tests/codeception.yml b/tests/codeception.yml index 7a91e5e..6e6c3ae 100644 --- a/tests/codeception.yml +++ b/tests/codeception.yml @@ -1,28 +1,28 @@ namespace: OxidEsales\GraphQL\ConfigurationAccess\Tests\Codeception params: - - Codeception/Config/params.php + - Codeception/Config/params.php paths: - tests: Codeception - output: Codeception/_output - data: Codeception/_data - support: Codeception/_support - envs: Codeception/_envs - actor_suffix: Tester + tests: Codeception + output: Codeception/_output + data: Codeception/_data + support: Codeception/_support + envs: Codeception/_envs + actor_suffix: Tester settings: - colors: true - log: true - memory_limit: 4096M + colors: true + log: true + memory_limit: 4096M extensions: - enabled: - - Codeception\Extension\RunFailed + enabled: + - Codeception\Extension\RunFailed coverage: - enabled: true - remote: false - local: true - c3_url: '%SHOP_URL%' - remote_config: 'vendor/oxid-esales/graphql-configuration-access/tests/codeception.yml' - include: - - ../src/* + enabled: true + remote: false + local: true + c3_url: '%SHOP_URL%' + remote_config: 'vendor/oxid-esales/graphql-configuration-access/tests/codeception.yml' + include: + - ../src/* diff --git a/tests/phpintegration.xml b/tests/phpintegration.xml index d06453e..cd3ed77 100644 --- a/tests/phpintegration.xml +++ b/tests/phpintegration.xml @@ -16,14 +16,14 @@ beStrictAboutTestsThatDoNotTestAnything="false" verbose="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> - - - ../src - - - - - Integration - - + + + ../src + + + + + Integration + +