From: Roland Häder Date: Sun, 16 Jul 2017 21:05:56 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=887340f2efadd02aa4a1e6d6d86529570184efa5 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. Signed-off-by: Roland Häder --- 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'); + } + }