]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Sun, 26 Feb 2017 18:58:40 +0000 (19:58 +0100)
committerRoland Haeder <roland@mxchange.org>
Tue, 28 Feb 2017 21:11:02 +0000 (22:11 +0100)
- added generic test on loading classes configured in some_foo_class entries
- now you can see, why "_class" must be set
- added method getConfigurationArray() in FrameworkConfiguration which returns
  the whole configuration array ...
- added "import" of XmlParser + fixed config entry with namespace
- added "import" of BaseParser and Parseable

Signed-off-by: Roland Häder <roland@mxchange.org>
framework/config.php
framework/config/class_FrameworkConfiguration.php
framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/decorator/xml/class_XmlCompactorDecorator.php
framework/main/classes/parser/xml/class_XmlParser.php
framework/main/classes/template/image/class_ImageTemplateEngine.php
framework/main/classes/template/mail/class_MailTemplateEngine.php
framework/main/classes/template/menu/class_MenuTemplateEngine.php
framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php

index f389f4b59bd576c6ae0542bd85c3c49ee5e3ded6..89fd2f3c42f01bfc3367988bb0e913bba86c8f9e 100644 (file)
@@ -266,7 +266,7 @@ $cfg->setConfigEntry('image_cmd_code_captcha_resolver_class', 'ImageCommandResol
 $cfg->setConfigEntry('mailer_class', 'DebugMailer');
 
 // CFG: XML-PARSER-CLASS
-$cfg->setConfigEntry('xml_parser_class', 'XmlParser');
+$cfg->setConfigEntry('xml_parser_class', 'CoreFramework\Parser\Xml\XmlParser');
 
 // CFG: DECO-COMPACTING-XML-PARSER-CLASS
 $cfg->setConfigEntry('deco_compacting_xml_parser_class', 'XmlCompactorDecorator');
index ee7439e8106b07551f4f0a30daab02011292bf62..733ba9e17e1f47f9960ccaec9301dea350f618fe 100644 (file)
@@ -209,6 +209,16 @@ class FrameworkConfiguration implements Registerable {
                ksort($this->config);
        }
 
+       /**
+        * Getter for whole configuration array
+        *
+        * @return      $config         Configuration array
+        */
+       public final function getConfigurationArray () {
+               // Return it
+               return $this->config;
+       }
+
        /**
         * Unset a configuration key, the entry must be there or else an
         * exception is thrown.
index 423fe29606e81d6eb750c79d2c6e626779e72f56..7185309257cc39270935f016fdd5ac9c99150785 100644 (file)
@@ -20,6 +20,7 @@ use CoreFramework\Loader\ClassLoader;
 use CoreFramework\Manager\ManageableApplication;
 use CoreFramework\Middleware\Compressor\CompressorChannel;
 use CoreFramework\Middleware\Debug\DebugMiddleware;
+use CoreFramework\Parser\Parseable;
 use CoreFramework\Registry\Register;
 use CoreFramework\Registry\Registry;
 use CoreFramework\Request\Requestable;
index 152eb9fb46dc8343bf8a2332fe9d807be9b08ffc..50fba45f93226052abd15dac2dd3f76432a9f797 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Parser\Xml;
 
 // Import framework stuff
 use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Parser\Parseable;
 
 /**
  * A XML compacting decorator class for XML parsers
index 318e344bf205fa68fb8e127430ea6a47b0f4ab81..7a84119bb681156abd146a2f71273b96f5d387ca 100644 (file)
@@ -3,6 +3,8 @@
 namespace CoreFramework\Parser\Xml;
 
 // Import framework stuff
+use CoreFramework\Parser\BaseParser;
+use CoreFramework\Parser\Parseable;
 use CoreFramework\Template\CompileableTemplate;
 
 /**
index c438b04916be4690904c2131235a379ccfc184a1..950b8867d00be4101d9d87ed08ee3092533f153a 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Template\Engine;
 
 // Import framework stuff
 use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Parser\Xml\XmlParser;
 use CoreFramework\Registry\Registry;
 use CoreFramework\Response\Responseable;
 use CoreFramework\Template\CompileableTemplate;
index 8f031a85419d6b31f5616f78b8d6de02c8eaab11..2c73e33c5d2ec4ede43b906ea02e479bc6b3b3e1 100644 (file)
@@ -3,6 +3,7 @@
 namespace CoreFramework\Template\Engine;
 
 // Import framework stuff
+use CoreFramework\Parser\Xml\XmlParser;
 use CoreFramework\Registry\Registry;
 use CoreFramework\Response\Responseable;
 use CoreFramework\Template\CompileableTemplate;
index 64ab5b3cd01abaf04970a5817b3dc8806172a64b..6663f8adc10423319eff05841d35810a7ccedca2 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Template\Engine;
 
 // Import framework stuff
 use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Parser\Xml\XmlParser;
 use CoreFramework\Registry\Registry;
 use CoreFramework\Template\CompileableTemplate;
 
index 175f5173cdc375f125db3f266e682fe171fc36cf..b6f49a7ae455b0a05c548ffba18e4505c096c1be 100644 (file)
@@ -8,6 +8,9 @@ use CoreFramework\Request\Requestable;
 use CoreFramework\Response\Responseable;
 use CoreFramework\Tests\Filter\BaseTestsFilter;
 
+// Import SPL stuff
+use \InvalidArgumentException;
+
 /**
  * A LoadableClasses filter for tests
  *
@@ -63,6 +66,39 @@ class TestConfigurationLoadableClassesFilter extends BaseTestsFilter implements
         * @todo        0% done
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Loop through all configuration keys
+               foreach ($this->getConfigInstance()->getConfigurationArray() as $configKey => $configValue) {
+                       // Key must end with _class
+                       if (substr($configKey, -6, 6) != '_class') {
+                               // Skip this
+                               continue;
+                       } // END - if
+
+                       // Output message
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Testing configKey=%s,configValue[%s]=%s', $configKey, gettype($configValue), $configValue));
+
+                       // This may throw exceptions
+                       try {
+                               // Is the class there?
+                               if (!class_exists($configValue)) {
+                                       // Class not found
+                                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Class "%s" not found. FAILED', $configValue));
+
+                                       // Skip further tests
+                                       continue;
+                               } // END - if
+                       } catch (InvalidArgumentException $e) {
+                               // Maybe not conform?
+                               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Class "%s" failed to load. Message: "%s"', $configValue, $e->getMessage()));
+
+                               // Skip further tests
+                               continue;
+                       }
+
+                       // class_exists() didn't fail
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Class "%s" loaded successfully. OKAY', $configValue));
+               } // END - foreach
+
                // Implement this!
                $this->partialStub('Please implement this method.');
        }