diff --git a/src/Module/Controller/ModuleActivationController.php b/src/Module/Controller/ModuleActivationController.php index 968e3f9..8a79cbf 100644 --- a/src/Module/Controller/ModuleActivationController.php +++ b/src/Module/Controller/ModuleActivationController.php @@ -9,15 +9,15 @@ namespace OxidEsales\GraphQL\ConfigurationAccess\Module\Controller; -use OxidEsales\GraphQL\ConfigurationAccess\Module\Service\ModuleSwitchServiceInterface; +use OxidEsales\GraphQL\ConfigurationAccess\Module\Service\ModuleActivationServiceInterface; use TheCodingMachine\GraphQLite\Annotations\Logged; use TheCodingMachine\GraphQLite\Annotations\Mutation; use TheCodingMachine\GraphQLite\Annotations\Right; -class ModuleSwitchController +class ModuleActivationController { public function __construct( - private readonly ModuleActivationServiceInterface $moduleService + private readonly ModuleActivationServiceInterface $moduleActivationService ) { } @@ -31,7 +31,7 @@ public function __construct( #[Right('CHANGE_CONFIGURATION')] public function activateModule(string $moduleId): bool { - return $this->moduleSwitchService->activateModule(moduleId: $moduleId); + return $this->moduleActivationService->activateModule(moduleId: $moduleId); } /** @@ -44,6 +44,6 @@ public function activateModule(string $moduleId): bool #[Right('CHANGE_CONFIGURATION')] public function deactivateModule(string $moduleId): bool { - return $this->moduleSwitchService->deactivateModule(moduleId: $moduleId); + return $this->moduleActivationService->deactivateModule(moduleId: $moduleId); } } diff --git a/tests/Codeception/Acceptance/Module/ModuleSwitchCest.php b/tests/Codeception/Acceptance/Module/ModuleActivationCest.php similarity index 78% rename from tests/Codeception/Acceptance/Module/ModuleSwitchCest.php rename to tests/Codeception/Acceptance/Module/ModuleActivationCest.php index f4b1d61..0dd6e61 100644 --- a/tests/Codeception/Acceptance/Module/ModuleSwitchCest.php +++ b/tests/Codeception/Acceptance/Module/ModuleActivationCest.php @@ -10,18 +10,19 @@ namespace OxidEsales\GraphQL\ConfigurationAccess\Tests\Codeception\Acceptance\Module; use Codeception\Attribute\DataProvider; +use OxidEsales\GraphQL\ConfigurationAccess\Tests\Codeception\Acceptance\BaseCest; use OxidEsales\GraphQL\ConfigurationAccess\Tests\Codeception\AcceptanceTester; /** - * @group module_switch + * @group module_activation * @group theme_switch * @group setting_access * @group oe_graphql_configuration_access */ -final class ModuleSwitchCest extends ModuleSettingBaseCest +final class ModuleActivationCest extends BaseCest { - #[DataProvider('moduleSwitchDataProvider')] - public function testModuleSwitchAuthorized(AcceptanceTester $I, \Codeception\Example $example): void + #[DataProvider('moduleDeActivationDataProvider')] + public function testModuleActivationAuthorized(AcceptanceTester $I, \Codeception\Example $example): void { $I->login($this->getAdminUsername(), $this->getAdminPassword()); @@ -52,7 +53,7 @@ private function runModuleMutation( return $I->grabJsonResponseAsArray(); } - protected function moduleSwitchDataProvider(): \Generator + protected function moduleDeActivationDataProvider(): \Generator { yield ['queryName' => 'activateModule', 'field' => 'moduleId']; yield ['queryName' => 'deactivateModule', 'field' => 'moduleId']; diff --git a/tests/Codeception/Acceptance/NotAuthorizedAccessCest.php b/tests/Codeception/Acceptance/NotAuthorizedAccessCest.php index b1a6009..7859aa6 100644 --- a/tests/Codeception/Acceptance/NotAuthorizedAccessCest.php +++ b/tests/Codeception/Acceptance/NotAuthorizedAccessCest.php @@ -13,7 +13,7 @@ use OxidEsales\GraphQL\ConfigurationAccess\Tests\Codeception\AcceptanceTester; /** - * @group module_switch + * @group module_activation * @group theme_setting * @group setting_access * @group oe_graphql_configuration_access diff --git a/tests/Unit/Module/Controller/ModuleActivationControllerTest.php b/tests/Unit/Module/Controller/ModuleActivationControllerTest.php index c5b7ac6..1941f3b 100644 --- a/tests/Unit/Module/Controller/ModuleActivationControllerTest.php +++ b/tests/Unit/Module/Controller/ModuleActivationControllerTest.php @@ -9,14 +9,14 @@ namespace OxidEsales\GraphQL\ConfigurationAccess\Tests\Unit\Module\Controller; -use OxidEsales\GraphQL\ConfigurationAccess\Module\Controller\ModuleSwitchController; +use OxidEsales\GraphQL\ConfigurationAccess\Module\Controller\ModuleActivationController; use OxidEsales\GraphQL\ConfigurationAccess\Module\Service\ModuleActivationServiceInterface; use PHPUnit\Framework\TestCase; /** - * @covers \OxidEsales\GraphQL\ConfigurationAccess\Module\Controller\ModuleSwitchController + * @covers \OxidEsales\GraphQL\ConfigurationAccess\Module\Controller\ModuleActivationController */ -class ModuleSwitchControllerTest extends TestCase +class ModuleActivationControllerTest extends TestCase { public function testActivateModule(): void { @@ -51,10 +51,10 @@ public function testDeactivateModule(): void } public function getSut( - ): ModuleSwitchController { - return new ModuleSwitchController( ModuleActivationServiceInterface $moduleActivationService = null - moduleService: $moduleActivationService + ): ModuleActivationController { + return new ModuleActivationController( + moduleActivationService: $moduleActivationService ); } }