]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 2 Mar 2023 01:44:37 +0000 (02:44 +0100)
committerRoland Häder <roland@mxchange.org>
Thu, 2 Mar 2023 01:44:37 +0000 (02:44 +0100)
- overall improval of framework tests (they aren't unit tests)
- added framework test for is_*_enabled configuration keys
- turned some Y/N into boolean (isEnabled() invoked instead of getConfigKey() == 'Y')

application/tests/classes/commands/console/class_TestsConsoleMainCommand.php
application/tests/classes/filter/tests/class_Tests
application/tests/classes/filter/tests/configuration/class_TestConfiguration [deleted file]
application/tests/classes/filter/tests/configuration/class_TestsConfiguration [new file with mode: 0644]
application/tests/classes/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php
application/tests/classes/filter/tests/configuration/is_enabled/class_TestsConfigurationIsEnabledFilter.php [new file with mode: 0644]
application/tests/classes/filter/tests/requirements/class_TestsPhpRequirementsFilter.php
application/tests/config.php
framework/config-global.php
framework/main/classes/file_directories/binary/class_BaseBinaryFile.php
framework/main/middleware/debug/class_DebugMiddleware.php

index 91bb107ec35b4b9f785ddbf7c4506dea5a929669..a88b097197f8416621ccf3ce979503405b4cf9c1 100644 (file)
@@ -98,7 +98,8 @@ class TestsConsoleMainCommand extends BaseCommand implements Commandable {
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('tests_php_requirements_filter_class'));
 
                // Add 'tests' filters which will run the actual tests
-               $controllerInstance->addTestsFilter(ObjectFactory::createObjectByConfiguredName('tests_configuration_classes_loadable_test_filter_class'));
+               $controllerInstance->addTestsFilter(ObjectFactory::createObjectByConfiguredName('tests_configuration_classes_loadable_filter_class'));
+               $controllerInstance->addTestsFilter(ObjectFactory::createObjectByConfiguredName('tests_configuration_is_enabled_filter_class'));
 
                // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('TESTS-CONSOLE-MAIN-COMMAND: EXIT!');
index ed4ff6d5377ecdcda790b75aae069751b63350dd..a5a1bc4e606d5e32c5428959a0e96669aaf72c3f 100644 (file)
@@ -1,14 +1,18 @@
 <?php
 // Own namespace
-namespace Org\Mxchange\CoreFramework\Tests\Filter\!!!;
+namespace Org\Mxchange\CoreFramework\Tests\Filter\???;
 
 // Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Filter\Filterable;
 use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Response\Responseable;
 use Org\Mxchange\CoreFramework\Tests\Filter\BaseTestsFilter;
 
+// Import SPL stuff
+use \InvalidArgumentException;
+
 /**
  * A ??? filter for tests
  *
@@ -49,9 +53,11 @@ class Tests???Filter extends BaseTestsFilter implements Filterable {
         */
        public final static function createTests???Filter () {
                // Get a new instance
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('TESTS-|||-FILTER: CALLED!');
                $filterInstance = new Tests???Filter();
 
                // Return the instance
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('TESTS-|||-FILTER: filterInstance=%s - EXIT!', $filterInstance->__toString()));
                return $filterInstance;
        }
 
@@ -64,8 +70,21 @@ class Tests???Filter extends BaseTestsFilter implements Filterable {
         * @todo        0% done
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Init counter
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('TESTS-|||-FILTER: requestInstance=%s,responseInstance=%s - CALLED!', $requestInstance->__toString(), $responseInstance->__toString()));
+               $passed = $failed = $skipped = $warning = 0;
+
                // Implement this!
                DebugMiddleware::getSelfInstance()->partialStub('Please implement this method.');
+
+               // Calculate percentage
+               $percent = (($passed + $failed) > 0 ? ($passed / ($passed + $failed) * 100) : 0);
+
+               // Output result
+               self::createDebugInstance(__CLASS__, __LINE__)->infoMessage(sprintf('Test result: %d okay, %d failed (%0.02f%% passed), %d skipped, %d warnings', $passed, $failed, $percent, $skipped, $warning));
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('TESTS-|||-FILTER: EXIT!');
        }
 
 }
diff --git a/application/tests/classes/filter/tests/configuration/class_TestConfiguration b/application/tests/classes/filter/tests/configuration/class_TestConfiguration
deleted file mode 100644 (file)
index f320543..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Tests\Filter\Configuration\!!!;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Filter\Filterable;
-use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
-use Org\Mxchange\CoreFramework\Request\Requestable;
-use Org\Mxchange\CoreFramework\Response\Responseable;
-use Org\Mxchange\CoreFramework\Tests\Filter\BaseTestsFilter;
-
-/**
- * A ??? filter for tests
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class TestConfiguration???Filter extends BaseTestsFilter implements Filterable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       private function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this filter class
-        *
-        * @return      $filterInstance         An instance of this filter class
-        */
-       public final static function createTestConfiguration???Filter () {
-               // Get a new instance
-               $filterInstance = new TestConfiguration???Filter();
-
-               // Return the instance
-               return $filterInstance;
-       }
-
-       /**
-        * Executes the filter with given request and response objects
-        *
-        * @param       $requestInstance        An instance of a class with an Requestable interface
-        * @param       $responseInstance       An instance of a class with an Responseable interface
-        * @return      void
-        * @todo        0% done
-        */
-       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // Implement this!
-               DebugMiddleware::getSelfInstance()->partialStub('Please implement this method.');
-       }
-
-}
diff --git a/application/tests/classes/filter/tests/configuration/class_TestsConfiguration b/application/tests/classes/filter/tests/configuration/class_TestsConfiguration
new file mode 100644 (file)
index 0000000..e6240ea
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Tests\Filter\Configuration\???;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Filter\Filterable;
+use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
+use Org\Mxchange\CoreFramework\Request\Requestable;
+use Org\Mxchange\CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Tests\Filter\BaseTestsFilter;
+
+// Import SPL stuff
+use \InvalidArgumentException;
+
+/**
+ * A ??? filter for configuration tests
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class TestsConfiguration???Filter extends BaseTestsFilter implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       private function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this filter class
+        *
+        * @return      $filterInstance         An instance of this filter class
+        */
+       public final static function createTestsConfiguration???Filter () {
+               // Get a new instance
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('TESTS-CONFIGURATION-|||-FILTER: CALLED!');
+               $filterInstance = new TestsConfiguration???Filter();
+
+               // Return the instance
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('TESTS-CONFIGURATION-|||-FILTER: filterInstance=%s - EXIT!', $filterInstance->__toString()));
+               return $filterInstance;
+       }
+
+       /**
+        * Executes the filter with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        * @todo        0% done
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Init counter
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('TESTS-CONFIGURATION-|||-FILTER: requestInstance=%s,responseInstance=%s - CALLED!', $requestInstance->__toString(), $responseInstance->__toString()));
+               $passed = $failed = $skipped = $warning = 0;
+
+               // Implement this!
+               DebugMiddleware::getSelfInstance()->partialStub('Please implement this method.');
+
+               // Calculate percentage
+               $percent = (($passed + $failed) > 0 ? ($passed / ($passed + $failed) * 100) : 0);
+
+               // Output result
+               self::createDebugInstance(__CLASS__, __LINE__)->infoMessage(sprintf('Test result: %d okay, %d failed (%0.02f%% passed), %d skipped, %d warning - EXIT!', $passed, $failed, $percent, $skipped, $warning));
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('TESTS-CONFIGURATION-|||-FILTER: EXIT!');
+       }
+
+}
index 4d7ce58e5079249b5d546ecc589ef3ad3f03fcd2..38990d1548b94c871c77018e93b1812b2c77c35d 100644 (file)
@@ -70,14 +70,12 @@ class TestConfigurationLoadableClassesFilter extends BaseTestsFilter implements
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Init counter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('TESTS-CONFIGURATION-LOADABLE-CLASSES-FILTER: requestInstance=%s,responseInstance=%s - CALLED!', $requestInstance->__toString(), $responseInstance->__toString()));
-               $passed = 0;
-               $failed = 0;
-               $skipped = 0;
+               $passed = $failed = $skipped = $warning = 0;
 
                // Loop through all configuration keys
                foreach (FrameworkBootstrap::getConfigurationInstance()->getConfigurationArray() as $configKey => $configValue) {
                        // Key must end with _class
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('TESTS-CONFIGURATION-LOADABLE-CLASSES-FILTER: configKey[%s]=%s,configValue[%s]=%s', gettype($configKey), $configKey, gettype($configValue), $configValue));
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('TESTS-CONFIGURATION-LOADABLE-CLASSES-FILTER: configKey[%s]=%s,configValue[%s]=%s', gettype($configKey), $configKey, gettype($configValue), $configValue));
                        if (substr($configKey, -6, 6) != '_class') {
                                // Skip this
                                $skipped++;
@@ -90,18 +88,18 @@ class TestConfigurationLoadableClassesFilter extends BaseTestsFilter implements
                                // Is the config entry valid and class is there?
                                if (!is_string($configValue)) {
                                        // Skip further tests
-                                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('configValue=%s has unexpected type "%s", required: string - FAILED!', $configValue, gettype($configValue)));
+                                       self::createDebugInstance(__CLASS__, __LINE__)->warningMessage(sprintf('configValue=%s has unexpected type "%s", required: string - FAILED!', $configValue, gettype($configValue)));
                                        $failed++;
                                        continue;
                                } elseif (!class_exists($configValue)) {
                                        // Skip further tests
-                                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('Class "%s" not found. FAILED!', $configValue));
+                                       self::createDebugInstance(__CLASS__, __LINE__)->warningMessage(sprintf('Class "%s" not found. FAILED!', $configValue));
                                        $failed++;
                                        continue;
                                }
                        } catch (InvalidArgumentException $e) {
                                // Maybe not conform?
-                               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->warningMessage(sprintf('Class "%s" failed to load. Message: "%s"', $configValue, $e->getMessage()));
+                               self::createDebugInstance(__CLASS__, __LINE__)->warningMessage(sprintf('Class "%s" failed to load. Message: "%s"', $configValue, $e->getMessage()));
 
                                // Skip further tests
                                $failed++;
@@ -113,8 +111,14 @@ class TestConfigurationLoadableClassesFilter extends BaseTestsFilter implements
                        $passed++;
                }
 
+               // Calculate percentage
+               $percent = (($passed + $failed) > 0 ? ($passed / ($passed + $failed) * 100) : 0);
+
                // Output result
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('Test result: %d okay, %d failed (%0.02f%% passed), %d skipped - EXIT!', $passed, $failed, ($passed / ($passed + $failed) * 100), $skipped));
+               self::createDebugInstance(__CLASS__, __LINE__)->infoMessage(sprintf('Test result: %d okay, %d failed (%0.02f%% passed), %d skipped, %d warning - EXIT!', $passed, $failed, $percent, $skipped, $warning));
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('TESTS-CONFIGURATION-LOADABLE-CLASSES-FILTER: EXIT!');
        }
 
 }
diff --git a/application/tests/classes/filter/tests/configuration/is_enabled/class_TestsConfigurationIsEnabledFilter.php b/application/tests/classes/filter/tests/configuration/is_enabled/class_TestsConfigurationIsEnabledFilter.php
new file mode 100644 (file)
index 0000000..1e4ae6a
--- /dev/null
@@ -0,0 +1,119 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Tests\Filter\Configuration\IsEnabled;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Filter\Filterable;
+use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
+use Org\Mxchange\CoreFramework\Request\Requestable;
+use Org\Mxchange\CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Tests\Filter\BaseTestsFilter;
+
+// Import SPL stuff
+use \InvalidArgumentException;
+
+/**
+ * A IsEnabled filter for configuration tests
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class TestsConfigurationIsEnabledFilter extends BaseTestsFilter implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       private function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this filter class
+        *
+        * @return      $filterInstance         An instance of this filter class
+        */
+       public final static function createTestsConfigurationIsEnabledFilter () {
+               // Get a new instance
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('TESTS-CONFIGURATION-IS-ENABLED-FILTER: CALLED!');
+               $filterInstance = new TestsConfigurationIsEnabledFilter();
+
+               // Return the instance
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('TESTS-CONFIGURATION-IS-ENABLED-FILTER: filterInstance=%s - EXIT!', $filterInstance->__toString()));
+               return $filterInstance;
+       }
+
+       /**
+        * Executes the filter with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        * @todo        0% done
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Init counter
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('TESTS-CONFIGURATION-IS-ENABLED-FILTER: requestInstance=%s,responseInstance=%s - CALLED!', $requestInstance->__toString(), $responseInstance->__toString()));
+               $passed = $failed = $skipped = $warning = 0;
+
+               // Loop through all configuration keys
+               foreach (FrameworkBootstrap::getConfigurationInstance()->getConfigurationArray() as $configKey => $configValue) {
+                       // Key must end with _class
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('TESTS-CONFIGURATION-IS-ENABLED-FILTER: configKey[%s]=%s,configValue[%s]=%s', gettype($configKey), $configKey, gettype($configValue), $configValue));
+                       if (substr($configKey, 0, 3) != 'is_' && substr($configKey, -8, 8) != '_enabled') {
+                               // Is this a boolean value?
+                               if (is_bool($configValue)) {
+                                       // Issue a warning
+                                       self::createDebugInstance(__CLASS__, __LINE__)->warningMessage(sprintf('TESTS-CONFIGURATION-IS-ENABLED-FILTER: comnfigKey=%s has a boolean value[]=%s', $configKey, gettype($configValue)));
+                                       $warning++;
+                               } else {
+                                       // Mark as skipped
+                                       self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('TESTS-CONFIGURATION-IS-ENABLED-FILTER: comnfigKey=%s is not wanted here - SKIPPED!', $configKey));
+                                       $skipped++;
+                               }
+
+                               // Skip this
+                               continue;
+                       }
+
+                       // Is it boolean?
+                       if (!is_bool($configValue)) {
+                               // Failed!
+                               self::createDebugInstance(__CLASS__, __LINE__)->warningMessage(sprintf('Configuration key "%s" is NOT boolean. FAILED', $configKey));
+                               $failed++;
+                       } else {
+                               // Count as success
+                               self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('Configuration key "%s" is a boolean feature. OKAY', $configKey));
+                               $passed++;
+                       }
+               }
+
+               // Calculate percentage
+               $percent = (($passed + $failed) > 0 ? ($passed / ($passed + $failed) * 100) : 0);
+
+               // Output result
+               self::createDebugInstance(__CLASS__, __LINE__)->infoMessage(sprintf('Test result: %d okay, %d failed (%0.02f%% passed), %d skipped, $d warnings', $passed, $failed, $percent, $skipped, $warning));
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('TESTS-CONFIGURATION-IS-ENABLED-FILTER: EXIT!');
+       }
+
+}
index f390e7f469696d5252ba257fbebca9785393c76b..2d8b9916ab94b907d21fee1897dfdf6aa99637ad 100644 (file)
@@ -1,14 +1,18 @@
 <?php
 // Own namespace
-namespace Org\Mxchange\CoreFramework\Tests\Filter\Requirements;
+namespace Org\Mxchange\CoreFramework\Tests\Filter\PhpRequirements;
 
 // Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Filter\Filterable;
 use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Response\Responseable;
 use Org\Mxchange\CoreFramework\Tests\Filter\BaseTestsFilter;
 
+// Import SPL stuff
+use \InvalidArgumentException;
+
 /**
  * A PhpRequirements filter for tests
  *
@@ -49,9 +53,11 @@ class TestsPhpRequirementsFilter extends BaseTestsFilter implements Filterable {
         */
        public final static function createTestsPhpRequirementsFilter () {
                // Get a new instance
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('TESTS-PHP-REQUIREMENTS-FILTER: CALLED!');
                $filterInstance = new TestsPhpRequirementsFilter();
 
                // Return the instance
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('TESTS-PHP-REQUIREMENTS-FILTER: filterInstance=%s - EXIT!', $filterInstance->__toString()));
                return $filterInstance;
        }
 
@@ -64,8 +70,21 @@ class TestsPhpRequirementsFilter extends BaseTestsFilter implements Filterable {
         * @todo        0% done
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Init counter
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('TESTS-PHP-REQUIREMENTS-FILTER: requestInstance=%s,responseInstance=%s - CALLED!', $requestInstance->__toString(), $responseInstance->__toString()));
+               $passed = $failed = $skipped = $warning = 0;
+
                // Implement this!
                DebugMiddleware::getSelfInstance()->partialStub('Please implement this method.');
+
+               // Calculate percentage
+               $percent = (($passed + $failed) > 0 ? ($passed / ($passed + $failed) * 100) : 0);
+
+               // Output result
+               self::createDebugInstance(__CLASS__, __LINE__)->infoMessage(sprintf('Test result: %d okay, %d failed (%0.02f%% passed), %d skipped, %d warnings', $passed, $failed, $percent, $skipped, $warning));
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('TESTS-PHP-REQUIREMENTS-FILTER: EXIT!');
        }
 
 }
index af8d854fa1c7f2b2afc37017f002c168bce9966a..17ffa86757a05b5dcf0a5168907691820d5a488c 100644 (file)
@@ -52,10 +52,13 @@ $cfg->setConfigEntry('news_reader_main_class', 'Org\Mxchange\CoreFramework\Reade
 $cfg->setConfigEntry('news_main_limit', 5);
 
 // CFG: TESTS-PHP-REQUIREMENTS-FILTER
-$cfg->setConfigEntry('tests_php_requirements_filter_class', 'Org\Mxchange\CoreFramework\Tests\Filter\Requirements\TestsPhpRequirementsFilter');
+$cfg->setConfigEntry('tests_php_requirements_filter_class', 'Org\Mxchange\CoreFramework\Tests\Filter\PhpRequirements\TestsPhpRequirementsFilter');
 
 // CFG: TEST-CONFIGURATION-CLASSES-LOADABLE-TEST-FILTER-CLASS
-$cfg->setConfigEntry('tests_configuration_classes_loadable_test_filter_class', 'Org\Mxchange\CoreFramework\Tests\Filter\Configuration\Classes\TestConfigurationLoadableClassesFilter');
+$cfg->setConfigEntry('tests_configuration_classes_loadable_filter_class', 'Org\Mxchange\CoreFramework\Tests\Filter\Configuration\Classes\TestConfigurationLoadableClassesFilter');
+
+// CFG: TEST-CONFIGURATION-IS-ENABLED-TEST-FILTER-CLASS
+$cfg->setConfigEntry('tests_configuration_is_enabled_filter_class', 'Org\Mxchange\CoreFramework\Tests\Filter\Configuration\IsEnabled\TestsConfigurationIsEnabledFilter');
 
 // CFG: TEST-CONSOLE-CONTROLLER-RESOLVER-CLASS
 $cfg->setConfigEntry('tests_console_controller_resolver_class', 'Org\Mxchange\CoreFramework\Tests\Resolver\Controller\TestsConsoleControllerResolver');
index 6d8608defc69d6260e10b7461ba882f2616490ea..6f019d43673e53256ab40d01a3f63326b3bd3944 100644 (file)
@@ -337,18 +337,12 @@ $cfg->setConfigEntry('csv_input_file_class', 'Org\Mxchange\CoreFramework\Filesys
 // CFG: FILE-ITERATOR-CLASS
 $cfg->setConfigEntry('file_iterator_class', 'Org\Mxchange\CoreFramework\Iterator\File\FileIterator');
 
-// CFG: FILE-STACK-PRE-ALLOCATE-ENABLED
-$cfg->setConfigEntry('file_stack_pre_allocate_enabled', 'Y');
-
 // CFG: FILE-STACK-PRE-ALLOCATE-COUNT
 $cfg->setConfigEntry('file_stack_pre_allocate_count', 10000);
 
 // CFG: INDEX-INDEX-CLASS
 $cfg->setConfigEntry('file_stack_index_class', 'Org\Mxchange\CoreFramework\Index\File\Stack\FileStackIndex');
 
-// CFG: INDEX-PRE-ALLOCATE-ENABLED
-$cfg->setConfigEntry('index_pre_allocate_enabled', 'Y');
-
 // CFG: INDEX-PRE-ALLOCATE-COUNT
 $cfg->setConfigEntry('index_pre_allocate_count', 10000);
 
@@ -498,3 +492,9 @@ $cfg->setConfigEntry('is_db_update_primary_forced_enabled', true);
 
 // CFG: IS-QUIET-DNS-RESOLVER-ENABLED
 $cfg->setConfigEntry('is_quiet_dns_resolver_enabled', false);
+
+// CFG: IS-FILE-STACK-PRE-ALLOCATE-ENABLED
+$cfg->setConfigEntry('is_file_stack_pre_allocate_enabled', true);
+
+// CFG: IS-INDEX-PRE-ALLOCATE-ENABLED
+$cfg->setConfigEntry('is_index_pre_allocate_enabled', true);
index b7ddafcde7ce1472d4871a9434ab0f5fa40655ae..a7a1dcfd3ff0de9c228b56e122f59dbacebf26af 100644 (file)
@@ -903,7 +903,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
                } elseif ($minimumBlockLength < 1) {
                        // Invalid block length
                        throw new InvalidArgumentException(sprintf('Parameter minimumBlockLength=%d is not valid', $minimumBlockLength));
-               } elseif (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($type . '_pre_allocate_enabled') != 'Y') {
+               } elseif (!FrameworkBootstrap::getConfigurationInstance()->isEnabled($type . '_pre_allocate')) {
                        // Don't continue here.
                        self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: Not pre-allocating file.'));
                        return;
index 13fe73daf9a9af504636a701d99cff4d1f666586..dae80dbba3cada78a2e10ab1148c4ae579956599 100644 (file)
@@ -199,7 +199,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
 
                // Use debug output handler
                //* NOISY-DEBUG: */ printf('[%s:%d]: Invoking this->output(%s,%d) ...' . PHP_EOL, __METHOD__, __LINE__, $message, intval($stripTags));
-               $this->output($message, $stripTags);
+               $this->output(sprintf('TRACE: %s', $message), $stripTags);
 
                // Trace message
                //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
@@ -231,7 +231,39 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
 
                // Use debug output handler
                //* NOISY-DEBUG: */ printf('[%s:%d]: Invoking this->output(%s,%d) ...' . PHP_EOL, __METHOD__, __LINE__, $message, intval($stripTags));
-               $this->output($message, $stripTags);
+               $this->output(sprintf('DEBUG: %s', $message), $stripTags);
+
+               // Trace message
+               //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
+       }
+
+       /**
+        * Outputs an informational message whether to debug instance (should be set!) or
+        * dies with or ptints the message. Do NEVER EVER rewrite the exit() call to
+        * ApplicationEntryPoint::app_exit(), this would cause an endless loop.
+        *
+        * @param       $message        Message we shall send out...
+        * @param       $doPrint        Whether print or die here (default: print)
+        * @paran       $stripTags      Whether to strip tags (default: false)
+        * @return      void
+        * @throws      InvalidArgumentException        If a parameter has an invalid value
+        * @throws      NullPointerException    If this->outputInstance is NULL
+        * @todo        Remove $doPrint parameter
+        */
+       public function infoMessage (string $message, bool $doPrint = true, bool $stripTags = false) {
+               // Check parameter
+               //* NOISY-DEBUG: */ printf('[%s:%d]: message=%s,doPrint=%d,stripTags=%d - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $message, intval($doPrint), intval($stripTags));
+               if (empty($message)) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "message" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
+               } elseif (is_null($this->getOutputInstance())) {
+                       // Should not be NULL
+                       throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+               }
+
+               // Use debug output handler
+               //* NOISY-DEBUG: */ printf('[%s:%d]: Invoking this->output(%s,%d) ...' . PHP_EOL, __METHOD__, __LINE__, $message, intval($stripTags));
+               $this->output(sprintf('INFO: %s', $message), $stripTags);
 
                // Trace message
                //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
@@ -263,7 +295,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
 
                // Use debug output handler
                //* NOISY-DEBUG: */ printf('[%s:%d]: Invoking this->output(%s,%d) ...' . PHP_EOL, __METHOD__, __LINE__, $message, intval($stripTags));
-               $this->output($message, $stripTags);
+               $this->output(sprintf('WARNING: %s', $message), $stripTags);
 
                // Trace message
                //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
@@ -294,7 +326,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
        }
 
        /**
-        * Outputs a debug message whether to debug instance (should be set!) or
+        * Outputs a deprecated message whether to debug instance (should be set!) or
         * dies with or ptints the message. Do NEVER EVER rewrite the exit() call to
         * ApplicationEntryPoint::app_exit(), this would cause an endless loop.
         *
@@ -305,7 +337,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
         * @throws      InvalidArgumentException        If a parameter has an invalid value
         * @throws      NullPointerException    If this->outputInstance is NULL
         * @todo        Remove $doPrint parameter
-        * @deprecated  Rewrite to "new" methods above
+        * @todo        When all old method invocations are fixed, renamed this do deprecatedMessage
         */
        public function debugOutput (string $message, bool $doPrint = true, bool $stripTags = false) {
                // Check parameter
@@ -318,8 +350,8 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
                        throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
                }
 
-               // Invoke new version
-               $this->debugMessage($message, $doPrint, $stripTags);
+               // Invoke Inner method
+               $this->outputMessage(sprintf('DEPRECATED: %s', $message), $doPrint, $stripTags);
 
                // Trace message
                //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);