Skip to content

Commit

Permalink
OXDEV-8216: Rename ModuleSwitchController to ModuleActivationController
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelOxid committed Aug 12, 2024
1 parent 5b02a65 commit 78333ca
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
10 changes: 5 additions & 5 deletions src/Module/Controller/ModuleActivationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
}

Expand All @@ -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);
}

/**
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -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'];
Expand Down
2 changes: 1 addition & 1 deletion tests/Codeception/Acceptance/NotAuthorizedAccessCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/Module/Controller/ModuleActivationControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
);
}
}

0 comments on commit 78333ca

Please sign in to comment.