From 8299ccb72d96421ad5097935d89d578b59d8181e Mon Sep 17 00:00:00 2001 From: marcelmanzel Date: Mon, 12 Aug 2024 13:41:33 +0200 Subject: [PATCH] OXDEV-8216: Change constants to private; Add deactivation Exception test; --- src/Module/Exception/ModuleActivationException.php | 2 +- src/Module/Exception/ModuleDeactivationException.php | 2 +- .../Exception/ModuleActivationExceptionTest.php | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Module/Exception/ModuleActivationException.php b/src/Module/Exception/ModuleActivationException.php index 5178b8a..ccc51f9 100644 --- a/src/Module/Exception/ModuleActivationException.php +++ b/src/Module/Exception/ModuleActivationException.php @@ -13,7 +13,7 @@ final class ModuleActivationException extends NotFound { - public const EXCEPTION_MESSAGE = "An error occurred while activating the module."; + private const EXCEPTION_MESSAGE = "An error occurred while activating the module."; public function __construct() { diff --git a/src/Module/Exception/ModuleDeactivationException.php b/src/Module/Exception/ModuleDeactivationException.php index 68fc0b8..553084c 100644 --- a/src/Module/Exception/ModuleDeactivationException.php +++ b/src/Module/Exception/ModuleDeactivationException.php @@ -13,7 +13,7 @@ final class ModuleDeactivationException extends NotFound { - public const EXCEPTION_MESSAGE = "An error occurred while deactivating the module."; + private const EXCEPTION_MESSAGE = "An error occurred while deactivating the module."; public function __construct() { diff --git a/tests/Unit/Module/Exception/ModuleActivationExceptionTest.php b/tests/Unit/Module/Exception/ModuleActivationExceptionTest.php index 554366e..5598cc3 100644 --- a/tests/Unit/Module/Exception/ModuleActivationExceptionTest.php +++ b/tests/Unit/Module/Exception/ModuleActivationExceptionTest.php @@ -10,6 +10,7 @@ namespace OxidEsales\GraphQL\ConfigurationAccess\Tests\Unit\Module\Exception; use OxidEsales\GraphQL\ConfigurationAccess\Module\Exception\ModuleActivationException; +use OxidEsales\GraphQL\ConfigurationAccess\Module\Exception\ModuleDeactivationException; use PHPUnit\Framework\TestCase; /** @@ -17,11 +18,19 @@ */ final class ModuleActivationExceptionTest extends TestCase { - public function testException(): void + public function testActivationException(): void { $exception = new ModuleActivationException(); $this->assertInstanceOf(ModuleActivationException::class, $exception); $this->assertSame('An error occurred while activating the module.', $exception->getMessage()); } + + public function testDeactivationException(): void + { + $exception = new ModuleDeactivationException(); + + $this->assertInstanceOf(ModuleDeactivationException::class, $exception); + $this->assertSame('An error occurred while deactivating the module.', $exception->getMessage()); + } }