From 72b8616d552eae789a2c4137750c676a7744d4b6 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sun, 26 Feb 2017 20:09:07 +0100 Subject: [PATCH] Continued: - fixed some configuration entries, missing namespace - output nice statistics about passed and failed tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- framework/config.php | 12 ++++++------ .../class_TestConfigurationLoadableClassesFilter.php | 10 ++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/framework/config.php b/framework/config.php index 89fd2f3c..186e838a 100644 --- a/framework/config.php +++ b/framework/config.php @@ -197,10 +197,10 @@ $cfg->setConfigEntry('file_output_class', 'CoreFramework\Stream\Filesystem\FileI $cfg->setConfigEntry('email_validator_filter_class', 'EmailValidatorFilter'); // CFG: USERNAME-VALIDATOR-FILTER-CLASS -$cfg->setConfigEntry('username_validator_filter_class', 'UserNameValidatorFilter'); +$cfg->setConfigEntry('username_validator_filter_class', 'CoreFramework\Filter\Validator\Username\UserNameValidatorFilter'); // CFG: USERNAME-IS-GUEST-FILTER-CLASS -$cfg->setConfigEntry('username_is_guest_filter_class', 'UserNameIsGuestFilter'); +$cfg->setConfigEntry('username_is_guest_filter_class', 'CoreFramework\Filter\User\Username\UserNameIsGuestFilter'); // CFG: PASSWORD-VALIDATOR-FILTER-CLASS $cfg->setConfigEntry('password_validator_filter_class', 'PasswordValidatorFilter'); @@ -209,10 +209,10 @@ $cfg->setConfigEntry('password_validator_filter_class', 'PasswordValidatorFilter $cfg->setConfigEntry('rules_accepted_filter_class', 'RulesAcceptedFilter'); // CFG: USERNAME-VERIFIER-FILTER-CLASS -$cfg->setConfigEntry('username_verifier_filter_class', 'UserNameVerifierFilter'); +$cfg->setConfigEntry('username_verifier_filter_class', 'CoreFramework\Filter\Verifier\User\UserNameVerifierFilter'); // CFG: USER-GUEST-VERIFIER-FILTER-CLASS -$cfg->setConfigEntry('user_guest_verifier_filter_class', 'UserGuestVerifierFilter'); +$cfg->setConfigEntry('user_guest_verifier_filter_class', 'CoreFramework\Filter\Verifier\User\UserGuestVerifierFilter'); // CFG: EMAIL-VERIFIER-FILTER-CLASS $cfg->setConfigEntry('email_verifier_filter_class', 'EmailVerifierFilter'); @@ -233,10 +233,10 @@ $cfg->setConfigEntry('password_change_filter_class', 'PasswordChangeFilter'); $cfg->setConfigEntry('account_password_filter_class', 'AccountPasswordVerifierFilter'); // CFG: USER-STATUS-FILTER-CLASS -$cfg->setConfigEntry('user_status_filter_class', 'UserStatusVerifierFilter'); +$cfg->setConfigEntry('user_status_filter_class', 'CoreFramework\Filter\Verifier\User\UserStatusVerifierFilter'); // CFG: USER-UNCONFIRMED-FILTER-CLASS -$cfg->setConfigEntry('user_unconfirmed_filter_class', 'UserUnconfirmedVerifierFilter'); +$cfg->setConfigEntry('user_unconfirmed_filter_class', 'CoreFramework\Filter\Verifier\User\UserUnconfirmedVerifierFilter'); // CFG: CRYPTO-CLASS $cfg->setConfigEntry('crypto_class', 'CryptoHelper'); diff --git a/framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php b/framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php index b6f49a7a..cf2ff995 100644 --- a/framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php +++ b/framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php @@ -66,6 +66,10 @@ class TestConfigurationLoadableClassesFilter extends BaseTestsFilter implements * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Init counter + $passed = 0; + $failed = 0; + // Loop through all configuration keys foreach ($this->getConfigInstance()->getConfigurationArray() as $configKey => $configValue) { // Key must end with _class @@ -85,6 +89,7 @@ class TestConfigurationLoadableClassesFilter extends BaseTestsFilter implements self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Class "%s" not found. FAILED', $configValue)); // Skip further tests + $failed++; continue; } // END - if } catch (InvalidArgumentException $e) { @@ -92,13 +97,18 @@ class TestConfigurationLoadableClassesFilter extends BaseTestsFilter implements self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Class "%s" failed to load. Message: "%s"', $configValue, $e->getMessage())); // Skip further tests + $failed++; continue; } // class_exists() didn't fail self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Class "%s" loaded successfully. OKAY', $configValue)); + $passed++; } // END - foreach + // Output result + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Test result: %d okay, %d failed (%0.02f%% passed)', $passed, $failed, ($passed / ($passed + $failed)))); + // Implement this! $this->partialStub('Please implement this method.'); } -- 2.39.5