Skip to content

Commit

Permalink
OXDEV-8489: Cleanup rebase conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelOxid committed Aug 13, 2024
1 parent 2251478 commit f34a8a6
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 203 deletions.
8 changes: 1 addition & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.2.0] - Unreleased

### Added
- Prevention of deactivation of certain modules mentioned in modules_blocklist.yaml.
- Mutations to activate and deactive a module.

## [1.2.0] - Unreleased

Expand All @@ -16,16 +11,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Module list and filtering option on basis of module name and status
- Activation of given theme by themeId
- Mutations to activate and deactive a module.
- Prevention of deactivation of certain modules mentioned in modules_blocklist.yaml.

## [1.1.0] - 2024-07-05
This is stable release for v1.1.0. No changes have been made since v1.1.0-rc.1.

## [1.1.0-rc.1] - 2024-05-30
[.gitignore](.gitignore)
### Added
- PHP 8.2 support
- Module activation dependency on GraphQL Base module
- Activate a given theme by themeId.

### Changed
- PHPUnit upgraded to version 10.x
Expand Down
54 changes: 0 additions & 54 deletions src/Module/Infrastructure/ModuleSwitchInfrastructure.php

This file was deleted.

24 changes: 0 additions & 24 deletions src/Module/Infrastructure/ModuleSwitchInfrastructureInterface.php

This file was deleted.

9 changes: 8 additions & 1 deletion src/Module/Service/ModuleActivationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class ModuleActivationService implements ModuleActivationServiceInterface
{
public function __construct(
private readonly ContextInterface $context,
private readonly ModuleActivationBridgeInterface $moduleActivationBridge
private readonly ModuleActivationBridgeInterface $moduleActivationBridge,
private readonly ModuleBlocklistServiceInterface $moduleBlocklistService
) {
}

Expand All @@ -43,6 +44,12 @@ public function activateModule(string $moduleId): bool
*/
public function deactivateModule(string $moduleId): bool
{
if ($this->moduleBlocklistService->isModuleBlocked($moduleId)) {
throw new ModuleDeactivationException(
sprintf(ModuleDeactivationException::BLOCKED_MODULE_MESSAGE, $moduleId)
);
}

$shopId = $this->context->getCurrentShopId();

try {
Expand Down
Empty file.
Empty file.
115 changes: 0 additions & 115 deletions tests/Unit/Module/Infrastructure/ModuleSwitchInfrastructureTest.php

This file was deleted.

14 changes: 12 additions & 2 deletions tests/Unit/Module/Service/ModuleActivationsServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use OxidEsales\GraphQL\ConfigurationAccess\Module\Exception\ModuleActivationException;
use OxidEsales\GraphQL\ConfigurationAccess\Module\Exception\ModuleDeactivationException;
use OxidEsales\GraphQL\ConfigurationAccess\Module\Service\ModuleActivationService;
use OxidEsales\GraphQL\ConfigurationAccess\Module\Service\ModuleBlocklistServiceInterface;
use OxidEsales\GraphQL\ConfigurationAccess\Tests\Unit\UnitTestCase;

/**
Expand All @@ -34,6 +35,12 @@ public function testModuleActivationAndDeactivation(
->method($method)
->with($moduleId, $shopId);

$moduleBlocklistServiceMock = $this->createMock(ModuleBlocklistServiceInterface::class);
$moduleBlocklistServiceMock
->method('isModuleBlocked')
->with($moduleId)
->willReturn(false);

$sut = $this->getSut(
context: $this->getContextMock($shopId),
moduleActivationBridge: $moduleActivationBridgeMock
Expand Down Expand Up @@ -94,13 +101,16 @@ public static function exceptionDataProvider(): \Generator

public function getSut(
ContextInterface $context = null,
ModuleActivationBridgeInterface $moduleActivationBridge = null
ModuleActivationBridgeInterface $moduleActivationBridge = null,
ModuleBlocklistServiceInterface $moduleBlocklistService = null
): ModuleActivationService {
return new ModuleActivationService(
context: $context
?? $this->createStub(ContextInterface::class),
moduleActivationBridge: $moduleActivationBridge
?? $this->createStub(ModuleActivationBridgeInterface::class)
?? $this->createStub(ModuleActivationBridgeInterface::class),
moduleBlocklistService: $moduleBlocklistService
?? $this->createStub(ModuleBlocklistServiceInterface::class)
);
}
}

0 comments on commit f34a8a6

Please sign in to comment.