* @return void
*/
public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
- // @TODO Unfinished
- return;
+ // Add pre filters (e.g. for requirements checks)
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('tests_php_requirements_filter_class'));
- // Add pre filters
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('tests_php_requirements_filter'));
+ // Add 'tests' filters which will run the actual tests
+ $controllerInstance->addTestsFilter(ObjectFactory::createObjectByConfiguredName('tests_configuration_classes_loadable_test_filter_class'));
}
}
parent::__construct(__CLASS__);
// Init additional filter chains
- /*
- * @TODO maybe later more:
- 'bootstrap', 'activation',
- */
- foreach (array('shutdown') as $filterChain) {
+ foreach (array('bootstrap', 'tests', 'shutdown') as $filterChain) {
$this->initFilterChain($filterChain);
} // END - foreach
}
$controllerInstance->setResolverInstance($resolverInstance);
// Add news filters to this controller
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter'));
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter_class'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter_class'));
// Return the prepared instance
return $controllerInstance;
}
/**
- * Executes all bootstrap filters
+ * Add a tests filter
*
- * @param $requestInstance A Requestable class
- * @param $responseInstance A Responseable class
+ * @param $filterInstance A Filterable class
* @return void
*/
- public function executeBootstrapFilters (Requestable $requestInstance, Responseable $responseInstance) {
- $this->executeFilters('bootstrap', $requestInstance, $responseInstance);
+ public function addTestsFilter (Filterable $filterInstance) {
+ $this->addFilter('tests', $filterInstance);
}
/**
- * Add a hub activation filter
+ * Executes all bootstrap filters
*
- * @param $filterInstance A Filterable class
+ * @param $requestInstance A Requestable class
+ * @param $responseInstance A Responseable class
* @return void
*/
- public function addActivationFilter (Filterable $filterInstance) {
- $this->addFilter('activation', $filterInstance);
+ public function executeBootstrapFilters (Requestable $requestInstance, Responseable $responseInstance) {
+ $this->executeFilters('bootstrap', $requestInstance, $responseInstance);
}
/**
- * Executes all hub activation filters
+ * Executes all tests filters
*
* @param $requestInstance A Requestable class
* @param $responseInstance A Responseable class
* @return void
*/
- public function executeActivationFilters (Requestable $requestInstance, Responseable $responseInstance) {
- $this->executeFilters('activation', $requestInstance, $responseInstance);
+ public function executeTestsFilters (Requestable $requestInstance, Responseable $responseInstance) {
+ $this->executeFilters('tests', $requestInstance, $responseInstance);
}
}
--- /dev/null
+Deny from all
--- /dev/null
+<?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);
+ }
+
+}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace CoreFramework\Tests\Filter\!!!;
+
+// Import framework stuff
+use CoreFramework\Filter\Filterable;
+use CoreFramework\Request\Requestable;
+use CoreFramework\Response\Responseable;
+
+/**
+ * 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.');
+ }
+
+}
--- /dev/null
+Deny from all
--- /dev/null
+<?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.');
+ }
+
+}
$cfg->setConfigEntry('tests_console_cmd_main_resolver_class', 'CoreFramework\Tests\Resolver\Command\TestsConsoleCommandResolver');
// CFG: NEWS-DOWNLOAD-FILTER
-$cfg->setConfigEntry('news_download_filter', 'CoreFramework\Filter\News\NewsDownloadFilter');
+$cfg->setConfigEntry('news_download_filter_class', 'CoreFramework\Filter\News\NewsDownloadFilter');
// CFG: NEWS-PROCESS-FILTER
-$cfg->setConfigEntry('news_process_filter', 'CoreFramework\Filter\News\NewsProcessFilter');
+$cfg->setConfigEntry('news_process_filter_class', 'CoreFramework\Filter\News\NewsProcessFilter');
// CFG: NEWS-READER-MAIN-CLASS
$cfg->setConfigEntry('news_reader_main_class', 'CoreFramework\Reader\News\Console\ConsoleNewsReader');
// CFG: NEWS-MAIN-LIMIT
$cfg->setConfigEntry('news_main_limit', 5);
+
+// CFG: TESTS-PHP-REQUIREMENTS-FILTER
+$cfg->setConfigEntry('tests_php_requirements_filter_class', 'CoreFramework\Tests\Filter\Requirements\TestsPhpRequirementsFilter');
$cfg->setConfigEntry('file_output_class', 'CoreFramework\Stream\Filesystem\FileIoStream');
// CFG: EMAIL-VALIDATOR-FILTER
-$cfg->setConfigEntry('email_validator_filter', 'EmailValidatorFilter');
+$cfg->setConfigEntry('email_validator_filter_class', 'EmailValidatorFilter');
// CFG: USERNAME-VALIDATOR-FILTER
-$cfg->setConfigEntry('username_validator_filter', 'UserNameValidatorFilter');
+$cfg->setConfigEntry('username_validator_filter_class', 'UserNameValidatorFilter');
// CFG: USERNAME-IS-GUEST-FILTER
-$cfg->setConfigEntry('username_is_guest_filter', 'UserNameIsGuestFilter');
+$cfg->setConfigEntry('username_is_guest_filter_class', 'UserNameIsGuestFilter');
// CFG: PASSWORD-VALIDATOR-FILTER
-$cfg->setConfigEntry('password_validator_filter', 'PasswordValidatorFilter');
+$cfg->setConfigEntry('password_validator_filter_class', 'PasswordValidatorFilter');
// CFG: RULES-ACCEPTED-FILTER
-$cfg->setConfigEntry('rules_accepted_filter', 'RulesAcceptedFilter');
+$cfg->setConfigEntry('rules_accepted_filter_class', 'RulesAcceptedFilter');
// CFG: USERNAME-VERIFIER-FILTER
-$cfg->setConfigEntry('username_verifier_filter', 'UserNameVerifierFilter');
+$cfg->setConfigEntry('username_verifier_filter_class', 'UserNameVerifierFilter');
// CFG: USER-GUEST-VERIFIER-FILTER
-$cfg->setConfigEntry('user_guest_verifier_filter', 'UserGuestVerifierFilter');
+$cfg->setConfigEntry('user_guest_verifier_filter_class', 'UserGuestVerifierFilter');
// CFG: EMAIL-VERIFIER-FILTER
-$cfg->setConfigEntry('email_verifier_filter', 'EmailVerifierFilter');
+$cfg->setConfigEntry('email_verifier_filter_class', 'EmailVerifierFilter');
// CFG: PASSWORD-VERIFIER-FILTER
-$cfg->setConfigEntry('password_verifier_filter', 'PasswordVerifierFilter');
+$cfg->setConfigEntry('password_verifier_filter_class', 'PasswordVerifierFilter');
// CFG: PASSWD-GUEST-VERIFIER-FILTER
-$cfg->setConfigEntry('passwd_guest_verifier_filter', 'PasswordGuestVerifierFilter');
+$cfg->setConfigEntry('passwd_guest_verifier_filter_class', 'PasswordGuestVerifierFilter');
// CFG: EMAIL-CHANGE-FILTER
-$cfg->setConfigEntry('email_change_filter', 'EmailChangeFilter');
+$cfg->setConfigEntry('email_change_filter_class', 'EmailChangeFilter');
// CFG: PASSWORD-CHANGE-FILTER
-$cfg->setConfigEntry('password_change_filter', 'PasswordChangeFilter');
+$cfg->setConfigEntry('password_change_filter_class', 'PasswordChangeFilter');
// CFG: ACCOUNT-PASSWORD-FILTER
-$cfg->setConfigEntry('account_password_filter', 'AccountPasswordVerifierFilter');
+$cfg->setConfigEntry('account_password_filter_class', 'AccountPasswordVerifierFilter');
// CFG: USER-STATUS-FILTER
-$cfg->setConfigEntry('user_status_filter', 'UserStatusVerifierFilter');
+$cfg->setConfigEntry('user_status_filter_class', 'UserStatusVerifierFilter');
// CFG: USER-UNCONFIRMED-FILTER
-$cfg->setConfigEntry('user_unconfirmed_filter', 'UserUnconfirmedVerifierFilter');
+$cfg->setConfigEntry('user_unconfirmed_filter_class', 'UserUnconfirmedVerifierFilter');
// CFG: CRYPTO-CLASS
$cfg->setConfigEntry('crypto_class', 'CryptoHelper');
*/
public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
// Add user status filter here
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter_class'));
}
}
*/
public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
// Filter for checking if account is unconfirmed
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_unconfirmed_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_unconfirmed_filter_class'));
}
}
$controllerInstance->setResolverInstance($resolverInstance);
// Add news filters to this controller
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter'));
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter_class'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter_class'));
// Return the prepared instance
return $controllerInstance;
$controllerInstance->setResolverInstance($resolverInstance);
// Add filters for handling confirmation code and username
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter'));
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_unconfirmed_filter'));
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('confirm_code_verifier_filter'));
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_confirmed_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter_class'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_unconfirmed_filter_class'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('confirm_code_verifier_filter_class'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_confirmed_filter_class'));
// Return the prepared instance
return $controllerInstance;
$controllerInstance->setResolverInstance($resolverInstance);
// Add news filters to this controller
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter'));
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter_class'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter_class'));
// Return the prepared instance
return $controllerInstance;
$controllerInstance->setResolverInstance($resolverInstance);
// Add user auth filter (we don't need an update of the user here because it will be redirected)
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter_class'));
// User status filter
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter_class'));
// Return the prepared instance
return $controllerInstance;
$controllerInstance->setResolverInstance($resolverInstance);
// User auth filter
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter_class'));
// User update filter
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter_class'));
// News fetcher filter
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter_class'));
// News proccess/display-preparation
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter_class'));
// Return the prepared instance
return $controllerInstance;
$controllerInstance->setResolverInstance($resolverInstance);
// Add filter for checking the "encrypt" string
- $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_encrypt_validator_filter'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_encrypt_validator_filter_class'));
// Return the prepared instance
return $controllerInstance;