]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 16 Jul 2017 21:05:56 +0000 (23:05 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 16 Jul 2017 21:05:56 +0000 (23:05 +0200)
- 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 <roland@mxchange.org>
framework/config/class_FrameworkConfiguration.php
tests/framework/config/FrameworkConfigurationTest.php

index 9f158c362518c8dac127aebf275c599ed6cb6804..26c47d4268062f14b4cb6eda492d96fef71e13db 100644 (file)
@@ -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);
        }
 
        /**
index d3e8ccd5fc7d992d696bd702d705978443505597..329e01ca996b22359d3444e7a78959e7142393b9 100644 (file)
@@ -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');
+       }
+
 }