-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OXDEV-8489: Create new ModuleDeactivationBlockedException
- Loading branch information
1 parent
882a344
commit 06112e1
Showing
7 changed files
with
76 additions
and
10 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/Module/Exception/ModuleDeactivationBlockedException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\GraphQL\ConfigurationAccess\Module\Exception; | ||
|
||
use OxidEsales\GraphQL\Base\Exception\NotFound; | ||
|
||
final class ModuleDeactivationBlockedException extends NotFound | ||
{ | ||
private const EXCEPTION_MESSAGE = 'Module "%s" is in the blocklist and cannot be deactivated.'; | ||
|
||
public function __construct(string $moduleId) | ||
{ | ||
parent::__construct(sprintf(self::EXCEPTION_MESSAGE, $moduleId)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
tests/Unit/Module/Exception/ModuleDeactivationBlockedExceptionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\GraphQL\ConfigurationAccess\Tests\Unit\Module\Exception; | ||
|
||
use OxidEsales\GraphQL\ConfigurationAccess\Module\Exception\ModuleDeactivationBlockedException; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \OxidEsales\GraphQL\ConfigurationAccess\Module\Exception\ModuleDeactivationBlockedException | ||
*/ | ||
final class ModuleDeactivationBlockedExceptionTest extends TestCase | ||
{ | ||
public function testException(): void | ||
{ | ||
$moduleId = uniqid(); | ||
$exception = new ModuleDeactivationBlockedException($moduleId); | ||
|
||
$this->assertInstanceOf(ModuleDeactivationBlockedException::class, $exception); | ||
$this->assertSame( | ||
sprintf('Module "%s" is in the blocklist and cannot be deactivated.', $moduleId), | ||
$exception->getMessage() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters