]> git.mxchange.org Git - core.git/commitdiff
Moving-session has started:
authorRoland Haeder <roland@mxchange.org>
Sun, 26 Feb 2017 16:07:55 +0000 (17:07 +0100)
committerRoland Haeder <roland@mxchange.org>
Tue, 28 Feb 2017 21:11:02 +0000 (22:11 +0100)
- moved all files in application/tests/classes/ to framework/main/tests/ as
  they can (and should) be used by any application that wishes to run (unit)
  tests.

Signed-off-by: Roland Häder <roland@mxchange.org>
49 files changed:
application/tests/classes/.htaccess [deleted file]
application/tests/classes/commands/.htaccess [deleted file]
application/tests/classes/commands/console/.htaccess [deleted file]
application/tests/classes/commands/console/class_TestsConsoleMainCommand.php [deleted file]
application/tests/classes/controller/.htaccess [deleted file]
application/tests/classes/controller/console/.htaccess [deleted file]
application/tests/classes/controller/console/class_TestsConsoleDefaultNewsController.php [deleted file]
application/tests/classes/filter/.htaccess [deleted file]
application/tests/classes/filter/class_BaseTestsFilter.php [deleted file]
application/tests/classes/filter/tests/.htaccess [deleted file]
application/tests/classes/filter/tests/class_Tests [deleted file]
application/tests/classes/filter/tests/configuration/.htaccess [deleted file]
application/tests/classes/filter/tests/configuration/class_TestConfiguration [deleted file]
application/tests/classes/filter/tests/configuration/classes/.htaccess [deleted file]
application/tests/classes/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php [deleted file]
application/tests/classes/filter/tests/requirements/.htaccess [deleted file]
application/tests/classes/filter/tests/requirements/class_TestsPhpRequirementsFilter.php [deleted file]
application/tests/classes/resolver/.htaccess [deleted file]
application/tests/classes/resolver/command/.htaccess [deleted file]
application/tests/classes/resolver/command/console/.htaccess [deleted file]
application/tests/classes/resolver/command/console/class_TestsConsoleCommandResolver.php [deleted file]
application/tests/classes/resolver/controller/.htaccess [deleted file]
application/tests/classes/resolver/controller/class_TestsConsoleControllerResolver.php [deleted file]
application/tests/init.php
application/tests/tests/.htaccess [new file with mode: 0644]
framework/loader/class_ClassLoader.php
framework/main/tests/.htaccess [new file with mode: 0644]
framework/main/tests/commands/.htaccess [new file with mode: 0644]
framework/main/tests/commands/console/.htaccess [new file with mode: 0644]
framework/main/tests/commands/console/class_TestsConsoleMainCommand.php [new file with mode: 0644]
framework/main/tests/controller/.htaccess [new file with mode: 0644]
framework/main/tests/controller/console/.htaccess [new file with mode: 0644]
framework/main/tests/controller/console/class_TestsConsoleDefaultNewsController.php [new file with mode: 0644]
framework/main/tests/filter/.htaccess [new file with mode: 0644]
framework/main/tests/filter/class_BaseTestsFilter.php [new file with mode: 0644]
framework/main/tests/filter/tests/.htaccess [new file with mode: 0644]
framework/main/tests/filter/tests/class_Tests [new file with mode: 0644]
framework/main/tests/filter/tests/configuration/.htaccess [new file with mode: 0644]
framework/main/tests/filter/tests/configuration/class_TestConfiguration [new file with mode: 0644]
framework/main/tests/filter/tests/configuration/classes/.htaccess [new file with mode: 0644]
framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php [new file with mode: 0644]
framework/main/tests/filter/tests/requirements/.htaccess [new file with mode: 0644]
framework/main/tests/filter/tests/requirements/class_TestsPhpRequirementsFilter.php [new file with mode: 0644]
framework/main/tests/resolver/.htaccess [new file with mode: 0644]
framework/main/tests/resolver/command/.htaccess [new file with mode: 0644]
framework/main/tests/resolver/command/console/.htaccess [new file with mode: 0644]
framework/main/tests/resolver/command/console/class_TestsConsoleCommandResolver.php [new file with mode: 0644]
framework/main/tests/resolver/controller/.htaccess [new file with mode: 0644]
framework/main/tests/resolver/controller/class_TestsConsoleControllerResolver.php [new file with mode: 0644]

diff --git a/application/tests/classes/.htaccess b/application/tests/classes/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/tests/classes/commands/.htaccess b/application/tests/classes/commands/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/tests/classes/commands/console/.htaccess b/application/tests/classes/commands/console/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/tests/classes/commands/console/class_TestsConsoleMainCommand.php b/application/tests/classes/commands/console/class_TestsConsoleMainCommand.php
deleted file mode 100644 (file)
index ce512ff..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-// Own namespace
-namespace CoreFramework\Tests\Command;
-
-// Import framework stuff
-use CoreFramework\Command\BaseCommand;
-use CoreFramework\Command\Commandable;
-use CoreFramework\Controller\Controller;
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Registry\Registry;
-use CoreFramework\Request\Requestable;
-use CoreFramework\Resolver\Command\CommandResolver;
-use CoreFramework\Response\Responseable;
-
-/**
- * A command for the 'main' routine
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 TestsConsoleMainCommand extends BaseCommand implements Commandable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this class
-        *
-        * @param       $resolverInstance       An instance of a command resolver class
-        * @return      $commandInstance        An instance a prepared command class
-        */
-       public static final function createTestsConsoleMainCommand (CommandResolver $resolverInstance) {
-               // Get new instance
-               $commandInstance = new TestsConsoleMainCommand();
-
-               // Set the application instance
-               $commandInstance->setResolverInstance($resolverInstance);
-
-               // Return the prepared instance
-               return $commandInstance;
-       }
-
-       /**
-        * Executes the given command 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
-        */
-       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // Debug message
-               self::createDebugInstance(__CLASS__)->debugOutput('MAIN: --- Starting tests ... ---');
-
-               // Get controller
-               $controllerInstance = Registry::getRegistry()->getInstance('controller');
-
-               // Run all tests
-               $controllerInstance->executeTestsFilters($requestInstance, $responseInstance);
-
-               // Debug message
-               self::createDebugInstance(__CLASS__)->debugOutput('MAIN: --- Leaving main ... ---');
-       }
-
-       /**
-        * Adds extra filters to the given controller instance
-        *
-        * @param       $controllerInstance             A controller instance
-        * @param       $requestInstance                An instance of a class with an Requestable interface
-        * @return      void
-        */
-       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
-               // Add pre filters (e.g. for requirements checks)
-               $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'));
-       }
-
-}
diff --git a/application/tests/classes/controller/.htaccess b/application/tests/classes/controller/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/tests/classes/controller/console/.htaccess b/application/tests/classes/controller/console/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/tests/classes/controller/console/class_TestsConsoleDefaultNewsController.php b/application/tests/classes/controller/console/class_TestsConsoleDefaultNewsController.php
deleted file mode 100644 (file)
index d86ebf3..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-// Own namespace
-namespace CoreFramework\Tests\Controller;
-
-// Import framework stuff
-use CoreFramework\Controller\BaseController;
-use CoreFramework\Controller\Controller;
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Filter\Filterable;
-use CoreFramework\Request\Requestable;
-use CoreFramework\Resolver\Command\CommandResolver;
-use CoreFramework\Response\Responseable;
-
-/**
- * The default controller with news for e.g. home or news page
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 TestsConsoleDefaultNewsController extends BaseController implements Controller {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Init additional filter chains
-               foreach (array('bootstrap', 'tests', 'shutdown') as $filterChain) {
-                       $this->initFilterChain($filterChain);
-               } // END - foreach
-       }
-
-       /**
-        * Creates an instance of this class
-        *
-        * @param       $resolverInstance               An instance of a command resolver class
-        * @return      $controllerInstance             A prepared instance of this class
-        */
-       public static final function createTestsConsoleDefaultNewsController (CommandResolver $resolverInstance) {
-               // Create the instance
-               $controllerInstance = new TestsConsoleDefaultNewsController();
-
-               // Set the command resolver
-               $controllerInstance->setResolverInstance($resolverInstance);
-
-               // Add news filters to this controller
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter_class'));
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter_class'));
-
-               // Return the prepared instance
-               return $controllerInstance;
-       }
-
-       /**
-        * Handles the given request and response
-        *
-        * @param       $requestInstance        An instance of a request class
-        * @param       $responseInstance       An instance of a response class
-        * @return      void
-        */
-       public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
-               // Get the command instance from the resolver by sending a request instance to the resolver
-               $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
-
-               // Add more filters by the command
-               $commandInstance->addExtraFilters($this, $requestInstance);
-
-               // Run the pre filters
-               $this->executePreFilters($requestInstance, $responseInstance);
-
-               // This request was valid! :-D
-               $requestInstance->requestIsValid();
-
-               // Execute the command
-               $commandInstance->execute($requestInstance, $responseInstance);
-
-               // Run the post filters
-               $this->executePostFilters($requestInstance, $responseInstance);
-
-               // Flush the response out
-               $responseInstance->flushBuffer();
-       }
-
-       /**
-        * Add a bootstrap filter
-        *
-        * @param       $filterInstance         A Filterable class
-        * @return      void
-        */
-       public function addBootstrapFilter (Filterable $filterInstance) {
-               $this->addFilter('bootstrap', $filterInstance);
-       }
-
-       /**
-        * Add a tests filter
-        *
-        * @param       $filterInstance         A Filterable class
-        * @return      void
-        */
-       public function addTestsFilter (Filterable $filterInstance) {
-               $this->addFilter('tests', $filterInstance);
-       }
-
-       /**
-        * Executes all bootstrap filters
-        *
-        * @param       $requestInstance        A Requestable class
-        * @param       $responseInstance       A Responseable class
-        * @return      void
-        */
-       public function executeBootstrapFilters (Requestable $requestInstance, Responseable $responseInstance) {
-               $this->executeFilters('bootstrap', $requestInstance, $responseInstance);
-       }
-
-       /**
-        * Executes all tests filters
-        *
-        * @param       $requestInstance        A Requestable class
-        * @param       $responseInstance       A Responseable class
-        * @return      void
-        */
-       public function executeTestsFilters (Requestable $requestInstance, Responseable $responseInstance) {
-               $this->executeFilters('tests', $requestInstance, $responseInstance);
-       }
-
-}
diff --git a/application/tests/classes/filter/.htaccess b/application/tests/classes/filter/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/tests/classes/filter/class_BaseTestsFilter.php b/application/tests/classes/filter/class_BaseTestsFilter.php
deleted file mode 100644 (file)
index 04a141f..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-// Own namespace
-namespace CoreFramework\Tests\Filter;
-
-// Import framework stuff
-use CoreFramework\Filter\BaseFilter;
-
-/**
- * A generic filter for tests
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 BaseTestsFilter extends BaseFilter {
-       /**
-        * Protected constructor
-        *
-        * @param       $className      Real name of class
-        * @return      void
-        */
-       protected function __construct ($className) {
-               // Call parent constructor
-               parent::__construct($className);
-       }
-
-}
diff --git a/application/tests/classes/filter/tests/.htaccess b/application/tests/classes/filter/tests/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/tests/classes/filter/tests/class_Tests b/application/tests/classes/filter/tests/class_Tests
deleted file mode 100644 (file)
index 9f84cde..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-// Own namespace
-namespace CoreFramework\Tests\Filter\!!!;
-
-// Import framework stuff
-use CoreFramework\Filter\Filterable;
-use CoreFramework\Request\Requestable;
-use CoreFramework\Response\Responseable;
-use 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 - 2017 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 Tests???Filter extends BaseTestsFilter implements Filterable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected 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 createTests???Filter () {
-               // Get a new instance
-               $filterInstance = new Tests???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!
-               $this->partialStub('Please implement this method.');
-       }
-
-}
diff --git a/application/tests/classes/filter/tests/configuration/.htaccess b/application/tests/classes/filter/tests/configuration/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
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 76afc51..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-// Own namespace
-namespace CoreFramework\Tests\Filter\Configuration\!!!;
-
-// Import framework stuff
-use CoreFramework\Filter\Filterable;
-use CoreFramework\Request\Requestable;
-use CoreFramework\Response\Responseable;
-use 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 - 2017 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
-        */
-       protected 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!
-               $this->partialStub('Please implement this method.');
-       }
-
-}
diff --git a/application/tests/classes/filter/tests/configuration/classes/.htaccess b/application/tests/classes/filter/tests/configuration/classes/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/tests/classes/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php b/application/tests/classes/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php
deleted file mode 100644 (file)
index 175f517..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-// Own namespace
-namespace CoreFramework\Tests\Filter\Configuration\Classes;
-
-// Import framework stuff
-use CoreFramework\Filter\Filterable;
-use CoreFramework\Request\Requestable;
-use CoreFramework\Response\Responseable;
-use CoreFramework\Tests\Filter\BaseTestsFilter;
-
-/**
- * A LoadableClasses filter for tests
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 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 TestConfigurationLoadableClassesFilter extends BaseTestsFilter implements Filterable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected 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 createTestConfigurationLoadableClassesFilter () {
-               // Get a new instance
-               $filterInstance = new TestConfigurationLoadableClassesFilter();
-
-               // 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!
-               $this->partialStub('Please implement this method.');
-       }
-
-}
diff --git a/application/tests/classes/filter/tests/requirements/.htaccess b/application/tests/classes/filter/tests/requirements/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/tests/classes/filter/tests/requirements/class_TestsPhpRequirementsFilter.php b/application/tests/classes/filter/tests/requirements/class_TestsPhpRequirementsFilter.php
deleted file mode 100644 (file)
index 969d9cf..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-// Own namespace
-namespace CoreFramework\Tests\Filter\Requirements;
-
-// Import framework stuff
-use CoreFramework\Filter\Filterable;
-use CoreFramework\Request\Requestable;
-use CoreFramework\Response\Responseable;
-use CoreFramework\Tests\Filter\BaseTestsFilter;
-
-/**
- * A PhpRequirements filter for tests
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 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 TestsPhpRequirementsFilter extends BaseTestsFilter implements Filterable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected 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 createTestsPhpRequirementsFilter () {
-               // Get a new instance
-               $filterInstance = new TestsPhpRequirementsFilter();
-
-               // 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!
-               $this->partialStub('Please implement this method.');
-       }
-
-}
diff --git a/application/tests/classes/resolver/.htaccess b/application/tests/classes/resolver/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/tests/classes/resolver/command/.htaccess b/application/tests/classes/resolver/command/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/tests/classes/resolver/command/console/.htaccess b/application/tests/classes/resolver/command/console/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/tests/classes/resolver/command/console/class_TestsConsoleCommandResolver.php b/application/tests/classes/resolver/command/console/class_TestsConsoleCommandResolver.php
deleted file mode 100644 (file)
index d7dfd9f..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-// Own namespace
-namespace CoreFramework\Tests\Resolver\Command;
-
-// Import framework stuff
-use CoreFramework\Command\InvalidCommandException;
-use CoreFramework\Generic\EmptyVariableException;
-use CoreFramework\Manager\ManageableApplication;
-use CoreFramework\Resolver\Command\BaseCommandResolver;
-use CoreFramework\Resolver\Command\CommandResolver;
-
-/**
- * A command resolver for console commands
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 TestsConsoleCommandResolver extends BaseCommandResolver implements CommandResolver {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Set prefix to "TestsConsole"
-               $this->setClassPrefix('tests_console');
-       }
-
-       /**
-        * Creates an instance of a TestsConsole command resolver with a given default command
-        *
-        * @param       $commandName                            The default command we shall execute
-        * @param       $applicationInstance            An instance of a manageable application helper class
-        * @return      $resolverInstance                       The prepared command resolver instance
-        * @throws      EmptyVariableException          Thrown if default command is not set
-        * @throws      InvalidCommandException         Thrown if default command is invalid
-        */
-       public static final function createTestsConsoleCommandResolver ($commandName, ManageableApplication $applicationInstance) {
-               // Create the new instance
-               $resolverInstance = new TestsConsoleCommandResolver();
-
-               // Is the variable $commandName set and the command is valid?
-               if (empty($commandName)) {
-                       // Then thrown an exception here
-                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-               } elseif ($resolverInstance->isCommandValid('CoreFramework\Tests\Command', $commandName) === FALSE) {
-                       // Invalid command found
-                       throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
-               }
-
-               // Set the application instance
-               $resolverInstance->setApplicationInstance($applicationInstance);
-               $resolverInstance->setNamespace('CoreFramework\Tests\Command');
-
-               // Return the prepared instance
-               return $resolverInstance;
-       }
-
-}
diff --git a/application/tests/classes/resolver/controller/.htaccess b/application/tests/classes/resolver/controller/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/tests/classes/resolver/controller/class_TestsConsoleControllerResolver.php b/application/tests/classes/resolver/controller/class_TestsConsoleControllerResolver.php
deleted file mode 100644 (file)
index 18124fa..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-// Own namespace
-namespace CoreFramework\Tests\Resolver\Controller;
-
-// Import framework stuff
-use CoreFramework\Controller\BaseController;
-use CoreFramework\Controller\Controller;
-use CoreFramework\Generic\EmptyVariableException;
-use CoreFramework\Manager\ManageableApplication;
-use CoreFramework\Resolver\Controller\BaseControllerResolver;
-use CoreFramework\Resolver\Controller\ControllerResolver;
-
-/**
- * A resolver for resolving controllers locally
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 TestsConsoleControllerResolver extends BaseControllerResolver implements ControllerResolver {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Set prefix to "TestsConsole"
-               $this->setClassPrefix('tests_console');
-       }
-
-       /**
-        * Creates an instance of a resolver class with a given command
-        *
-        * @param       $controllerName                         The controller we shall resolve
-        * @param       $applicationInstance            An instance of a manageable application helper class
-        * @return      $resolverInstance                       The prepared controller resolver instance
-        * @throws      EmptyVariableException          Thrown if default command is not set
-        * @throws      InvalidControllerException      Thrown if default controller is invalid
-        */
-       public static final function createTestsConsoleControllerResolver ($controllerName, ManageableApplication $applicationInstance) {
-               // Create the new instance
-               $resolverInstance = new TestsConsoleControllerResolver();
-
-               // Is the variable $controllerName set and the command is valid?
-               if (empty($controllerName)) {
-                       // Then thrown an exception here
-                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-               } elseif ($resolverInstance->isControllerValid('CoreFramework\Tests\Controller', $controllerName) === FALSE) {
-                       // Invalid command found
-                       throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
-               }
-
-               // Set the application instance
-               $resolverInstance->setApplicationInstance($applicationInstance);
-
-               // Set namespace and controller name
-               $resolverInstance->setNamespace('CoreFramework\Tests\Controller');
-               $resolverInstance->setControllerName($controllerName);
-
-               // Return the prepared instance
-               return $resolverInstance;
-       }
-
-       /**
-        * Resolves the default controller of the given command
-        *
-        * @return      $controllerInstance             A controller instance for the default
-        *                                                                      command
-        * @throws      InvalidControllerInstanceException      Thrown if $controllerInstance
-        *                                                                                              is invalid
-        */
-       public function resolveController () {
-               // Init variables
-               $controllerName = '';
-               $controllerInstance = NULL;
-
-               // Get namespace and command name
-               $controllerName = $this->getControllerName();
-
-               // Get the command
-               $controllerInstance = $this->loadController($controllerName);
-
-               // And validate it
-               if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
-                       // This command has an invalid instance!
-                       throw new InvalidControllerInstanceException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
-               } // END - if
-
-               // Set last controller
-               $this->setResolvedInstance($controllerInstance);
-
-               // Return the maybe resolved instance
-               return $controllerInstance;
-       }
-
-}
index d11063e97edda3305473a43f3a7c50fc5055fcc3..77c9fb873fc03fd4784710bf64edd5c386304118 100644 (file)
@@ -38,3 +38,12 @@ ApplicationHelper::createDebugInstance('ApplicationHelper');
 // This application needs a database connection then we have to simply include
 // the framework/database.php script
 require($cfg->getConfigEntry('base_path') . 'framework/database.php');
+
+// Register core tests
+ClassLoader::registerTestsPath('framework/main/tests');
+
+// Register own tests
+ClassLoader::registerTestsPath('application/tests/tests');
+
+// Scan for them now
+ClassLoader::scanTestsClasses();
diff --git a/application/tests/tests/.htaccess b/application/tests/tests/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
index 808edcf5b83fd0d77e69b9bae98ce023a643d95e..f4a69ab6e6297889384d583b9811a43886dc2d40 100644 (file)
@@ -124,6 +124,11 @@ class ClassLoader {
                'middleware'  // The middleware
        );
 
+       /**
+        * Registered paths where test classes can be found. These are all relative
+        * to base_path .
+        */
+       private static $testPaths = array();
 
        /**
         * The protected constructor. Please use the factory method below, or use
@@ -132,7 +137,7 @@ class ClassLoader {
         * @return      void
         */
        protected function __construct () {
-               // Is currently empty
+               // This is empty for now
        }
 
        /**
@@ -197,13 +202,16 @@ class ClassLoader {
                $loaderInstance = self::getSelfInstance();
 
                // Load all classes
-               foreach (self::$frameworkPaths as $pathName) {
+               foreach (self::$frameworkPaths as $shortPath) {
                        // Debug message
-                       //* NOISY-DEBUG: */ printf('[%s:%d]: pathName=%s' . PHP_EOL, __METHOD__, __LINE__, $pathName);
+                       //* NOISY-DEBUG: */ printf('[%s:%d]: shortPath=%s' . PHP_EOL, __METHOD__, __LINE__, $shortPath);
 
                        // Try to load the framework classes
-                       $loaderInstance->scanClassPath('framework/main/' . $pathName . '/');
+                       $loaderInstance->scanClassPath(sprintf('framework/main/%s/', $shortPath));
                } // END - foreach
+
+               // Trace message
+               //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
        }
 
        /**
@@ -219,12 +227,20 @@ class ClassLoader {
                $cfg = FrameworkConfiguration::getSelfInstance();
 
                // Load all classes for the application
-               foreach (self::$frameworkPaths as $class) {
+               foreach (self::$frameworkPaths as $shortPath) {
+                       // Debug message
+                       //* NOISY-DEBUG: */ printf('[%s:%d]: shortPath=%s' . PHP_EOL, __METHOD__, __LINE__, $shortPath);
+
                        // Create path name
-                       $pathName = sprintf('%s/%s/%s', $cfg->getConfigEntry('application_path'), $cfg->getConfigEntry('app_name'), $class);
+                       $pathName = realpath(sprintf(
+                               '%s/%s/%s',
+                               $cfg->getConfigEntry('application_path'),
+                               $cfg->getConfigEntry('app_name'),
+                               $shortPath
+                       ));
 
                        // Debug message
-                       //* NOISY-DEBUG: */ printf('[%s:%d]: pathName=%s' . PHP_EOL, __METHOD__, __LINE__, $pathName);
+                       //* NOISY-DEBUG: */ printf('[%s:%d]: pathName[%s]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($pathName), $pathName);
 
                        // Is the path readable?
                        if (is_dir($pathName)) {
@@ -232,56 +248,59 @@ class ClassLoader {
                                ClassLoader::getSelfInstance()->scanClassPath($pathName);
                        } // END - if
                } // END - foreach
+
+               // Trace message
+               //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
        }
 
        /**
-        * Initializes our loader class
+        * Scans for test classes, etc.
         *
-        * @param       $configInstance Configuration class instance
         * @return      void
         */
-       protected function initLoader (FrameworkConfiguration $configInstance) {
-               // Set configuration instance
-               $this->configInstance = $configInstance;
-
-               // Construct the FQFN for the cache
-               if (!defined('DEVELOPER')) {
-                       $this->listCacheFQFN  = $this->configInstance->getConfigEntry('local_db_path') . 'list-' . $this->configInstance->getConfigEntry('app_name') . '.cache';
-                       $this->classCacheFQFN = $this->configInstance->getConfigEntry('local_db_path') . 'class-' . $this->configInstance->getConfigEntry('app_name') . '.cache';
-               } // END - if
-
-               // Set suffix and prefix from configuration
-               $this->suffix = $configInstance->getConfigEntry('class_suffix');
-               $this->prefix = $configInstance->getConfigEntry('class_prefix');
+       public static function scanTestsClasses () {
+               // Trace message
+               //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
 
-               // Set own instance
-               self::$selfInstance = $this;
+               // Get config instance
+               $cfg = FrameworkConfiguration::getSelfInstance();
 
-               // Skip here if no dev-mode
-               if (defined('DEVELOPER')) {
-                       return;
-               } // END - if
+               // Load all classes for the application
+               foreach (self::$testPaths as $shortPath) {
+                       // Debug message
+                       //* NOISY-DEBUG: */ printf('[%s:%d]: shortPath=%s' . PHP_EOL, __METHOD__, __LINE__, $shortPath);
 
-               // IS the cache there?
-               if (BaseFrameworkSystem::isReadableFile($this->listCacheFQFN)) {
-                       // Get content
-                       $cacheContent = file_get_contents($this->listCacheFQFN);
+                       // Create path name
+                       $pathName = realpath(sprintf(
+                               '%s/%s',
+                               $cfg->getConfigEntry('base_path'),
+                               $shortPath
+                       ));
 
-                       // And convert it
-                       $this->foundClasses = json_decode($cacheContent);
+                       // Debug message
+                       //* NOISY-DEBUG: */ printf('[%s:%d]: pathName[%s]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($pathName), $pathName);
 
-                       // List has been restored from cache!
-                       $this->listCached = TRUE;
-               } // END - if
+                       // Is the path readable?
+                       if (is_dir($pathName)) {
+                               // Try to load the application classes
+                               ClassLoader::getSelfInstance()->scanClassPath($pathName);
+                       } // END - if
+               } // END - foreach
 
-               // Does the class cache exist?
-               if (BaseFrameworkSystem::isReadableFile($this->listCacheFQFN)) {
-                       // Then include it
-                       require($this->classCacheFQFN);
+               // Trace message
+               //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
+       }
 
-                       // Mark the class cache as loaded
-                       $this->classesCached = TRUE;
-               } // END - if
+       /**
+        * Registeres given relative path where test classes reside. For regular
+        * framework uses, they should not be loaded (and used).
+        *
+        * @param       $relativePath   Relative path to test classes
+        * @return      void
+        */
+       public static function registerTestsPath ($relativePath) {
+               // "Register" it
+               self::$testPaths[$relativePath] = $relativePath;
        }
 
        /**
@@ -417,6 +436,56 @@ class ClassLoader {
                $this->prefix = $oldPrefix;
        }
 
+       /**
+        * Initializes our loader class
+        *
+        * @param       $configInstance Configuration class instance
+        * @return      void
+        */
+       private function initLoader (FrameworkConfiguration $configInstance) {
+               // Set configuration instance
+               $this->configInstance = $configInstance;
+
+               // Construct the FQFN for the cache
+               if (!defined('DEVELOPER')) {
+                       $this->listCacheFQFN  = $this->configInstance->getConfigEntry('local_db_path') . 'list-' . $this->configInstance->getConfigEntry('app_name') . '.cache';
+                       $this->classCacheFQFN = $this->configInstance->getConfigEntry('local_db_path') . 'class-' . $this->configInstance->getConfigEntry('app_name') . '.cache';
+               } // END - if
+
+               // Set suffix and prefix from configuration
+               $this->suffix = $configInstance->getConfigEntry('class_suffix');
+               $this->prefix = $configInstance->getConfigEntry('class_prefix');
+
+               // Set own instance
+               self::$selfInstance = $this;
+
+               // Skip here if no dev-mode
+               if (defined('DEVELOPER')) {
+                       return;
+               } // END - if
+
+               // IS the cache there?
+               if (BaseFrameworkSystem::isReadableFile($this->listCacheFQFN)) {
+                       // Get content
+                       $cacheContent = file_get_contents($this->listCacheFQFN);
+
+                       // And convert it
+                       $this->foundClasses = json_decode($cacheContent);
+
+                       // List has been restored from cache!
+                       $this->listCached = TRUE;
+               } // END - if
+
+               // Does the class cache exist?
+               if (BaseFrameworkSystem::isReadableFile($this->listCacheFQFN)) {
+                       // Then include it
+                       require($this->classCacheFQFN);
+
+                       // Mark the class cache as loaded
+                       $this->classesCached = TRUE;
+               } // END - if
+       }
+
        /**
         * Tries to find the given class in our list. This method ignores silently
         * missing classes or interfaces. So if you use class_exists() this method
diff --git a/framework/main/tests/.htaccess b/framework/main/tests/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/commands/.htaccess b/framework/main/tests/commands/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/commands/console/.htaccess b/framework/main/tests/commands/console/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/commands/console/class_TestsConsoleMainCommand.php b/framework/main/tests/commands/console/class_TestsConsoleMainCommand.php
new file mode 100644 (file)
index 0000000..ce512ff
--- /dev/null
@@ -0,0 +1,101 @@
+<?php
+// Own namespace
+namespace CoreFramework\Tests\Command;
+
+// Import framework stuff
+use CoreFramework\Command\BaseCommand;
+use CoreFramework\Command\Commandable;
+use CoreFramework\Controller\Controller;
+use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Registry\Registry;
+use CoreFramework\Request\Requestable;
+use CoreFramework\Resolver\Command\CommandResolver;
+use CoreFramework\Response\Responseable;
+
+/**
+ * A command for the 'main' routine
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 TestsConsoleMainCommand extends BaseCommand implements Commandable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance       An instance of a command resolver class
+        * @return      $commandInstance        An instance a prepared command class
+        */
+       public static final function createTestsConsoleMainCommand (CommandResolver $resolverInstance) {
+               // Get new instance
+               $commandInstance = new TestsConsoleMainCommand();
+
+               // Set the application instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $commandInstance;
+       }
+
+       /**
+        * Executes the given command 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
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Debug message
+               self::createDebugInstance(__CLASS__)->debugOutput('MAIN: --- Starting tests ... ---');
+
+               // Get controller
+               $controllerInstance = Registry::getRegistry()->getInstance('controller');
+
+               // Run all tests
+               $controllerInstance->executeTestsFilters($requestInstance, $responseInstance);
+
+               // Debug message
+               self::createDebugInstance(__CLASS__)->debugOutput('MAIN: --- Leaving main ... ---');
+       }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @param       $requestInstance                An instance of a class with an Requestable interface
+        * @return      void
+        */
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               // Add pre filters (e.g. for requirements checks)
+               $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'));
+       }
+
+}
diff --git a/framework/main/tests/controller/.htaccess b/framework/main/tests/controller/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/controller/console/.htaccess b/framework/main/tests/controller/console/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/controller/console/class_TestsConsoleDefaultNewsController.php b/framework/main/tests/controller/console/class_TestsConsoleDefaultNewsController.php
new file mode 100644 (file)
index 0000000..d86ebf3
--- /dev/null
@@ -0,0 +1,145 @@
+<?php
+// Own namespace
+namespace CoreFramework\Tests\Controller;
+
+// Import framework stuff
+use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Controller;
+use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Filter\Filterable;
+use CoreFramework\Request\Requestable;
+use CoreFramework\Resolver\Command\CommandResolver;
+use CoreFramework\Response\Responseable;
+
+/**
+ * The default controller with news for e.g. home or news page
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 TestsConsoleDefaultNewsController extends BaseController implements Controller {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Init additional filter chains
+               foreach (array('bootstrap', 'tests', 'shutdown') as $filterChain) {
+                       $this->initFilterChain($filterChain);
+               } // END - foreach
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance               An instance of a command resolver class
+        * @return      $controllerInstance             A prepared instance of this class
+        */
+       public static final function createTestsConsoleDefaultNewsController (CommandResolver $resolverInstance) {
+               // Create the instance
+               $controllerInstance = new TestsConsoleDefaultNewsController();
+
+               // Set the command resolver
+               $controllerInstance->setResolverInstance($resolverInstance);
+
+               // Add news filters to this controller
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter_class'));
+
+               // Return the prepared instance
+               return $controllerInstance;
+       }
+
+       /**
+        * Handles the given request and response
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @param       $responseInstance       An instance of a response class
+        * @return      void
+        */
+       public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get the command instance from the resolver by sending a request instance to the resolver
+               $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+               // Add more filters by the command
+               $commandInstance->addExtraFilters($this, $requestInstance);
+
+               // Run the pre filters
+               $this->executePreFilters($requestInstance, $responseInstance);
+
+               // This request was valid! :-D
+               $requestInstance->requestIsValid();
+
+               // Execute the command
+               $commandInstance->execute($requestInstance, $responseInstance);
+
+               // Run the post filters
+               $this->executePostFilters($requestInstance, $responseInstance);
+
+               // Flush the response out
+               $responseInstance->flushBuffer();
+       }
+
+       /**
+        * Add a bootstrap filter
+        *
+        * @param       $filterInstance         A Filterable class
+        * @return      void
+        */
+       public function addBootstrapFilter (Filterable $filterInstance) {
+               $this->addFilter('bootstrap', $filterInstance);
+       }
+
+       /**
+        * Add a tests filter
+        *
+        * @param       $filterInstance         A Filterable class
+        * @return      void
+        */
+       public function addTestsFilter (Filterable $filterInstance) {
+               $this->addFilter('tests', $filterInstance);
+       }
+
+       /**
+        * Executes all bootstrap filters
+        *
+        * @param       $requestInstance        A Requestable class
+        * @param       $responseInstance       A Responseable class
+        * @return      void
+        */
+       public function executeBootstrapFilters (Requestable $requestInstance, Responseable $responseInstance) {
+               $this->executeFilters('bootstrap', $requestInstance, $responseInstance);
+       }
+
+       /**
+        * Executes all tests filters
+        *
+        * @param       $requestInstance        A Requestable class
+        * @param       $responseInstance       A Responseable class
+        * @return      void
+        */
+       public function executeTestsFilters (Requestable $requestInstance, Responseable $responseInstance) {
+               $this->executeFilters('tests', $requestInstance, $responseInstance);
+       }
+
+}
diff --git a/framework/main/tests/filter/.htaccess b/framework/main/tests/filter/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/filter/class_BaseTestsFilter.php b/framework/main/tests/filter/class_BaseTestsFilter.php
new file mode 100644 (file)
index 0000000..04a141f
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+// Own namespace
+namespace CoreFramework\Tests\Filter;
+
+// Import framework stuff
+use CoreFramework\Filter\BaseFilter;
+
+/**
+ * A generic filter for tests
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 BaseTestsFilter extends BaseFilter {
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Real name of class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+
+}
diff --git a/framework/main/tests/filter/tests/.htaccess b/framework/main/tests/filter/tests/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/filter/tests/class_Tests b/framework/main/tests/filter/tests/class_Tests
new file mode 100644 (file)
index 0000000..9f84cde
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+// Own namespace
+namespace CoreFramework\Tests\Filter\!!!;
+
+// Import framework stuff
+use CoreFramework\Filter\Filterable;
+use CoreFramework\Request\Requestable;
+use CoreFramework\Response\Responseable;
+use 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 - 2017 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 Tests???Filter extends BaseTestsFilter implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected 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 createTests???Filter () {
+               // Get a new instance
+               $filterInstance = new Tests???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!
+               $this->partialStub('Please implement this method.');
+       }
+
+}
diff --git a/framework/main/tests/filter/tests/configuration/.htaccess b/framework/main/tests/filter/tests/configuration/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/filter/tests/configuration/class_TestConfiguration b/framework/main/tests/filter/tests/configuration/class_TestConfiguration
new file mode 100644 (file)
index 0000000..76afc51
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+// Own namespace
+namespace CoreFramework\Tests\Filter\Configuration\!!!;
+
+// Import framework stuff
+use CoreFramework\Filter\Filterable;
+use CoreFramework\Request\Requestable;
+use CoreFramework\Response\Responseable;
+use 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 - 2017 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
+        */
+       protected 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!
+               $this->partialStub('Please implement this method.');
+       }
+
+}
diff --git a/framework/main/tests/filter/tests/configuration/classes/.htaccess b/framework/main/tests/filter/tests/configuration/classes/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php b/framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php
new file mode 100644 (file)
index 0000000..175f517
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+// Own namespace
+namespace CoreFramework\Tests\Filter\Configuration\Classes;
+
+// Import framework stuff
+use CoreFramework\Filter\Filterable;
+use CoreFramework\Request\Requestable;
+use CoreFramework\Response\Responseable;
+use CoreFramework\Tests\Filter\BaseTestsFilter;
+
+/**
+ * A LoadableClasses filter for tests
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 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 TestConfigurationLoadableClassesFilter extends BaseTestsFilter implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected 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 createTestConfigurationLoadableClassesFilter () {
+               // Get a new instance
+               $filterInstance = new TestConfigurationLoadableClassesFilter();
+
+               // 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!
+               $this->partialStub('Please implement this method.');
+       }
+
+}
diff --git a/framework/main/tests/filter/tests/requirements/.htaccess b/framework/main/tests/filter/tests/requirements/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/filter/tests/requirements/class_TestsPhpRequirementsFilter.php b/framework/main/tests/filter/tests/requirements/class_TestsPhpRequirementsFilter.php
new file mode 100644 (file)
index 0000000..969d9cf
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+// Own namespace
+namespace CoreFramework\Tests\Filter\Requirements;
+
+// Import framework stuff
+use CoreFramework\Filter\Filterable;
+use CoreFramework\Request\Requestable;
+use CoreFramework\Response\Responseable;
+use CoreFramework\Tests\Filter\BaseTestsFilter;
+
+/**
+ * A PhpRequirements filter for tests
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 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 TestsPhpRequirementsFilter extends BaseTestsFilter implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected 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 createTestsPhpRequirementsFilter () {
+               // Get a new instance
+               $filterInstance = new TestsPhpRequirementsFilter();
+
+               // 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!
+               $this->partialStub('Please implement this method.');
+       }
+
+}
diff --git a/framework/main/tests/resolver/.htaccess b/framework/main/tests/resolver/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/resolver/command/.htaccess b/framework/main/tests/resolver/command/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/resolver/command/console/.htaccess b/framework/main/tests/resolver/command/console/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/resolver/command/console/class_TestsConsoleCommandResolver.php b/framework/main/tests/resolver/command/console/class_TestsConsoleCommandResolver.php
new file mode 100644 (file)
index 0000000..d7dfd9f
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+// Own namespace
+namespace CoreFramework\Tests\Resolver\Command;
+
+// Import framework stuff
+use CoreFramework\Command\InvalidCommandException;
+use CoreFramework\Generic\EmptyVariableException;
+use CoreFramework\Manager\ManageableApplication;
+use CoreFramework\Resolver\Command\BaseCommandResolver;
+use CoreFramework\Resolver\Command\CommandResolver;
+
+/**
+ * A command resolver for console commands
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 TestsConsoleCommandResolver extends BaseCommandResolver implements CommandResolver {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set prefix to "TestsConsole"
+               $this->setClassPrefix('tests_console');
+       }
+
+       /**
+        * Creates an instance of a TestsConsole command resolver with a given default command
+        *
+        * @param       $commandName                            The default command we shall execute
+        * @param       $applicationInstance            An instance of a manageable application helper class
+        * @return      $resolverInstance                       The prepared command resolver instance
+        * @throws      EmptyVariableException          Thrown if default command is not set
+        * @throws      InvalidCommandException         Thrown if default command is invalid
+        */
+       public static final function createTestsConsoleCommandResolver ($commandName, ManageableApplication $applicationInstance) {
+               // Create the new instance
+               $resolverInstance = new TestsConsoleCommandResolver();
+
+               // Is the variable $commandName set and the command is valid?
+               if (empty($commandName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } elseif ($resolverInstance->isCommandValid('CoreFramework\Tests\Command', $commandName) === FALSE) {
+                       // Invalid command found
+                       throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
+               }
+
+               // Set the application instance
+               $resolverInstance->setApplicationInstance($applicationInstance);
+               $resolverInstance->setNamespace('CoreFramework\Tests\Command');
+
+               // Return the prepared instance
+               return $resolverInstance;
+       }
+
+}
diff --git a/framework/main/tests/resolver/controller/.htaccess b/framework/main/tests/resolver/controller/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/tests/resolver/controller/class_TestsConsoleControllerResolver.php b/framework/main/tests/resolver/controller/class_TestsConsoleControllerResolver.php
new file mode 100644 (file)
index 0000000..18124fa
--- /dev/null
@@ -0,0 +1,114 @@
+<?php
+// Own namespace
+namespace CoreFramework\Tests\Resolver\Controller;
+
+// Import framework stuff
+use CoreFramework\Controller\BaseController;
+use CoreFramework\Controller\Controller;
+use CoreFramework\Generic\EmptyVariableException;
+use CoreFramework\Manager\ManageableApplication;
+use CoreFramework\Resolver\Controller\BaseControllerResolver;
+use CoreFramework\Resolver\Controller\ControllerResolver;
+
+/**
+ * A resolver for resolving controllers locally
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 TestsConsoleControllerResolver extends BaseControllerResolver implements ControllerResolver {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set prefix to "TestsConsole"
+               $this->setClassPrefix('tests_console');
+       }
+
+       /**
+        * Creates an instance of a resolver class with a given command
+        *
+        * @param       $controllerName                         The controller we shall resolve
+        * @param       $applicationInstance            An instance of a manageable application helper class
+        * @return      $resolverInstance                       The prepared controller resolver instance
+        * @throws      EmptyVariableException          Thrown if default command is not set
+        * @throws      InvalidControllerException      Thrown if default controller is invalid
+        */
+       public static final function createTestsConsoleControllerResolver ($controllerName, ManageableApplication $applicationInstance) {
+               // Create the new instance
+               $resolverInstance = new TestsConsoleControllerResolver();
+
+               // Is the variable $controllerName set and the command is valid?
+               if (empty($controllerName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } elseif ($resolverInstance->isControllerValid('CoreFramework\Tests\Controller', $controllerName) === FALSE) {
+                       // Invalid command found
+                       throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+               }
+
+               // Set the application instance
+               $resolverInstance->setApplicationInstance($applicationInstance);
+
+               // Set namespace and controller name
+               $resolverInstance->setNamespace('CoreFramework\Tests\Controller');
+               $resolverInstance->setControllerName($controllerName);
+
+               // Return the prepared instance
+               return $resolverInstance;
+       }
+
+       /**
+        * Resolves the default controller of the given command
+        *
+        * @return      $controllerInstance             A controller instance for the default
+        *                                                                      command
+        * @throws      InvalidControllerInstanceException      Thrown if $controllerInstance
+        *                                                                                              is invalid
+        */
+       public function resolveController () {
+               // Init variables
+               $controllerName = '';
+               $controllerInstance = NULL;
+
+               // Get namespace and command name
+               $controllerName = $this->getControllerName();
+
+               // Get the command
+               $controllerInstance = $this->loadController($controllerName);
+
+               // And validate it
+               if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
+                       // This command has an invalid instance!
+                       throw new InvalidControllerInstanceException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+               } // END - if
+
+               // Set last controller
+               $this->setResolvedInstance($controllerInstance);
+
+               // Return the maybe resolved instance
+               return $controllerInstance;
+       }
+
+}