From: Roland Haeder Date: Sat, 25 Feb 2017 14:02:51 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=17916d2d3535455db6ab0e71f6fd06bf048383cd Continued: - added main command for "tests" - added "import" for BaseCommand - added "import" for PerformableAction Signed-off-by: Roland Häder --- diff --git a/application/tests/classes/commands/.htaccess b/application/tests/classes/commands/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/application/tests/classes/commands/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/tests/classes/commands/console/.htaccess b/application/tests/classes/commands/console/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/application/tests/classes/commands/console/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/tests/classes/commands/console/class_TestsConsoleMainCommand.php b/application/tests/classes/commands/console/class_TestsConsoleMainCommand.php new file mode 100644 index 00000000..81a2a47e --- /dev/null +++ b/application/tests/classes/commands/console/class_TestsConsoleMainCommand.php @@ -0,0 +1,106 @@ + + * @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 . + */ +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 + * @todo Try to create a TestsActivationTask or so + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get a registry and the application instance from it + $applicationInstance = Registry::getRegistry()->getInstance('app'); + + // 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 + * @todo Should we add some more filters? + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Add pre filters + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('node_php_requirements_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('node_initializer_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('node_welcome_teaser_filter')); + + // Add bootstrap filters + $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('node_bootstrap_generate_nodeid_filter')); + $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('node_bootstrap_generate_sessionid_filter')); + $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('node_bootstrap_generate_private_key_filter')); + $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('node_bootstrap_extra_bootstrapping_filter')); + $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('node_bootstrap_listener_pool_filter')); + + // Add node activation filters + $controllerInstance->addActivationFilter(ObjectFactory::createObjectByConfiguredName('node_activation_task_handler_initializer_filter')); + + // Add shutdown filters + $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('node_shutdown_flush_node_list_filter')); + $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('node_shutdown_task_handler_filter')); + + // This is the last generic shutdown filter + $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('node_shutdown_node_filter')); + } + +} diff --git a/inc/main/classes/actions/post_registration/class_LoginAfterRegistrationAction.php b/inc/main/classes/actions/post_registration/class_LoginAfterRegistrationAction.php index 4bb2c255..c12ab629 100644 --- a/inc/main/classes/actions/post_registration/class_LoginAfterRegistrationAction.php +++ b/inc/main/classes/actions/post_registration/class_LoginAfterRegistrationAction.php @@ -3,6 +3,7 @@ namespace CoreFramework\Action\PostRegistration\Login; // Import framework stuff +use CoreFramework\Action\PerformableAction; use CoreFramework\Generic\FrameworkException; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/commands/console/class_ConsoleFuseCommand.php b/inc/main/classes/commands/console/class_ConsoleFuseCommand.php index 22f4f5e7..d36f486a 100644 --- a/inc/main/classes/commands/console/class_ConsoleFuseCommand.php +++ b/inc/main/classes/commands/console/class_ConsoleFuseCommand.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command\Fuse; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/commands/html/class_HtmlConfirmCommand.php b/inc/main/classes/commands/html/class_HtmlConfirmCommand.php index a58f33e3..01cee190 100644 --- a/inc/main/classes/commands/html/class_HtmlConfirmCommand.php +++ b/inc/main/classes/commands/html/class_HtmlConfirmCommand.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command\Guest; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Generic\NullPointerException; use CoreFramework\Registry\Generic\Registry; diff --git a/inc/main/classes/commands/html/class_HtmlDoFormCommand.php b/inc/main/classes/commands/html/class_HtmlDoFormCommand.php index b03c2df9..f1c19304 100644 --- a/inc/main/classes/commands/html/class_HtmlDoFormCommand.php +++ b/inc/main/classes/commands/html/class_HtmlDoFormCommand.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command\Form; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/commands/html/class_HtmlHomeCommand.php b/inc/main/classes/commands/html/class_HtmlHomeCommand.php index f8bc1c5a..50350bb3 100644 --- a/inc/main/classes/commands/html/class_HtmlHomeCommand.php +++ b/inc/main/classes/commands/html/class_HtmlHomeCommand.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command\Guest; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/commands/html/class_HtmlLoginAreaCommand.php b/inc/main/classes/commands/html/class_HtmlLoginAreaCommand.php index 6db2c2ce..909cb92f 100644 --- a/inc/main/classes/commands/html/class_HtmlLoginAreaCommand.php +++ b/inc/main/classes/commands/html/class_HtmlLoginAreaCommand.php @@ -3,6 +3,8 @@ namespace CoreFramework\Command\Login; // Import framework stuff +use CoreFramework\Action\PerformableAction; +use CoreFramework\Command\BaseCommand; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Registry\Generic\Registry; use CoreFramework\Request\Requestable; diff --git a/inc/main/classes/commands/html/class_HtmlLoginCommand.php b/inc/main/classes/commands/html/class_HtmlLoginCommand.php index 5238d4de..fefa24ae 100644 --- a/inc/main/classes/commands/html/class_HtmlLoginCommand.php +++ b/inc/main/classes/commands/html/class_HtmlLoginCommand.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command\Login; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Registry\Registerable; use CoreFramework\Registry\Generic\Registry; diff --git a/inc/main/classes/commands/html/class_HtmlLoginFailedCommand.php b/inc/main/classes/commands/html/class_HtmlLoginFailedCommand.php index 62f3149f..7188904c 100644 --- a/inc/main/classes/commands/html/class_HtmlLoginFailedCommand.php +++ b/inc/main/classes/commands/html/class_HtmlLoginFailedCommand.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command\Failed; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/commands/html/class_HtmlLogoutCommand.php b/inc/main/classes/commands/html/class_HtmlLogoutCommand.php index c27e373a..20111df2 100644 --- a/inc/main/classes/commands/html/class_HtmlLogoutCommand.php +++ b/inc/main/classes/commands/html/class_HtmlLogoutCommand.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command\Login; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/commands/html/class_HtmlLogoutDoneCommand.php b/inc/main/classes/commands/html/class_HtmlLogoutDoneCommand.php index ded40104..fa669104 100644 --- a/inc/main/classes/commands/html/class_HtmlLogoutDoneCommand.php +++ b/inc/main/classes/commands/html/class_HtmlLogoutDoneCommand.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command\Logout; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/commands/html/class_HtmlProblemCommand.php b/inc/main/classes/commands/html/class_HtmlProblemCommand.php index b90ca404..a796c017 100644 --- a/inc/main/classes/commands/html/class_HtmlProblemCommand.php +++ b/inc/main/classes/commands/html/class_HtmlProblemCommand.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command\Failed; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/commands/html/class_HtmlRegisterCommand.php b/inc/main/classes/commands/html/class_HtmlRegisterCommand.php index e8867d44..388cf4ca 100644 --- a/inc/main/classes/commands/html/class_HtmlRegisterCommand.php +++ b/inc/main/classes/commands/html/class_HtmlRegisterCommand.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command\Register; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Registry\Registerable; use CoreFramework\Registry\Generic\Registry; diff --git a/inc/main/classes/commands/html/class_HtmlResendLinkCommand.php b/inc/main/classes/commands/html/class_HtmlResendLinkCommand.php index cd657967..57e8f64a 100644 --- a/inc/main/classes/commands/html/class_HtmlResendLinkCommand.php +++ b/inc/main/classes/commands/html/class_HtmlResendLinkCommand.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command\Guest; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Registry\Generic\Registry; use CoreFramework\Request\Requestable; diff --git a/inc/main/classes/commands/html/class_HtmlStatusCommand.php b/inc/main/classes/commands/html/class_HtmlStatusCommand.php index 4532722f..938e3cc9 100644 --- a/inc/main/classes/commands/html/class_HtmlStatusCommand.php +++ b/inc/main/classes/commands/html/class_HtmlStatusCommand.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command\Status; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/commands/image/class_ImageCodeCaptchaCommand.php b/inc/main/classes/commands/image/class_ImageCodeCaptchaCommand.php index 95876424..14345a55 100644 --- a/inc/main/classes/commands/image/class_ImageCodeCaptchaCommand.php +++ b/inc/main/classes/commands/image/class_ImageCodeCaptchaCommand.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command\Captcha; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; diff --git a/inc/main/classes/filter/payment/class_PaymentDiscoveryFilter.php b/inc/main/classes/filter/payment/class_PaymentDiscoveryFilter.php index e8729947..426976bc 100644 --- a/inc/main/classes/filter/payment/class_PaymentDiscoveryFilter.php +++ b/inc/main/classes/filter/payment/class_PaymentDiscoveryFilter.php @@ -3,6 +3,7 @@ namespace CoreFramework\Filter\Discovery\Payment; // Import framework stuff +use CoreFramework\Action\PerformableAction; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Generic\NullPointerException; use CoreFramework\Loader\NoClassException; diff --git a/inc/main/classes/resolver/command/console/class_ConsoleCommandResolver.php b/inc/main/classes/resolver/command/console/class_ConsoleCommandResolver.php index 7a06feb8..d8761931 100644 --- a/inc/main/classes/resolver/command/console/class_ConsoleCommandResolver.php +++ b/inc/main/classes/resolver/command/console/class_ConsoleCommandResolver.php @@ -3,6 +3,7 @@ namespace CoreFramework\Resolver\Command; // Import framework stuff +use CoreFramework\Command\BaseCommand; use CoreFramework\Command\InvalidCommandException; use CoreFramework\Manager\ManageableApplication; diff --git a/inc/main/interfaces/actions/commands/class_Commandable.php b/inc/main/interfaces/actions/commands/class_Commandable.php index 2b62566d..528e55f5 100644 --- a/inc/main/interfaces/actions/commands/class_Commandable.php +++ b/inc/main/interfaces/actions/commands/class_Commandable.php @@ -3,6 +3,7 @@ namespace CoreFramework\Command; // Import framework stuff +use CoreFramework\Action\PerformableAction; use CoreFramework\Request\Requestable; /**