From 887340f2efadd02aa4a1e6d6d86529570184efa5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 16 Jul 2017 23:05:56 +0200 Subject: [PATCH] Continued: - Also test unsupported methods if they are still unsupported. Please note, that these 2 methods may be removed from FrameworkInterface in the future as they come from very old times where no database frontend classes exist. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../config/class_FrameworkConfiguration.php | 4 +-- .../config/FrameworkConfigurationTest.php | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/framework/config/class_FrameworkConfiguration.php b/framework/config/class_FrameworkConfiguration.php index 9f158c36..26c47d42 100644 --- a/framework/config/class_FrameworkConfiguration.php +++ b/framework/config/class_FrameworkConfiguration.php @@ -480,7 +480,7 @@ class FrameworkConfiguration implements Registerable { */ public final function getField ($fieldName) { // The super interface "FrameworkInterface" requires this - throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); + throw new UnsupportedOperationException(array($this, __FUNCTION__), BaseFrameworkSystem::EXCEPTION_UNSPPORTED_OPERATION); } /** @@ -492,7 +492,7 @@ class FrameworkConfiguration implements Registerable { */ public function isFieldSet ($fieldName) { // The super interface "FrameworkInterface" requires this - throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); + throw new UnsupportedOperationException(array($this, __FUNCTION__), BaseFrameworkSystem::EXCEPTION_UNSPPORTED_OPERATION); } /** diff --git a/tests/framework/config/FrameworkConfigurationTest.php b/tests/framework/config/FrameworkConfigurationTest.php index d3e8ccd5..329e01ca 100644 --- a/tests/framework/config/FrameworkConfigurationTest.php +++ b/tests/framework/config/FrameworkConfigurationTest.php @@ -7,6 +7,7 @@ namespace CoreFramework\Configuration; use CoreFramework\Console\Tools\ConsoleTools; use CoreFramework\Loader\ClassLoader; use CoreFramework\Generic\NullPointerException; +use CoreFramework\Generic\UnsupportedOperationException; // Import PHPUnit stuff use PHPUnit\Framework\Error\Notice; @@ -904,4 +905,30 @@ class FrameworkConfigurationTest extends TestCase { self::$configInstance->setServerAddress(self::$ipAddress); } + /** + * Tests if the method getField() is still unsupported in this class. Please + * note, that this and isFieldSet() may get removed in the future. So also + * these test methods will be gone. + */ + public function testConfigGetFieldUnsupported () { + // Expect this exception + $this->expectException(UnsupportedOperationException::class); + + // Test it + $dummy = self::$configInstance->getField('foo'); + } + + /** + * Tests if the method isFieldSet() is still unsupported in this class. Please + * note, that this and getField() may get removed in the future. So also + * these test methods will be gone. + */ + public function testConfigIsFieldSetUnsupported () { + // Expect this exception + $this->expectException(UnsupportedOperationException::class); + + // Test it + $dummy = self::$configInstance->isFieldSet('foo'); + } + } -- 2.39.2