diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-05-13 15:59:22 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-05-13 15:59:22 +0000 |
commit | 3773f8d81c53dd0508325d6380ee49569951a61f (patch) | |
tree | c3ac0a4d080375bb325f140d0de66c33db703f80 /engine/lib/testing.php | |
parent | cf07718b4e44cb2711380a0ceb37de1031a5d4a8 (diff) | |
download | elgg-3773f8d81c53dd0508325d6380ee49569951a61f.tar.gz elgg-3773f8d81c53dd0508325d6380ee49569951a61f.tar.bz2 |
Refs #1009: Enhancements to diagnostics tool to use the test framework.
git-svn-id: https://code.elgg.org/elgg/trunk@3286 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/testing.php')
-rw-r--r-- | engine/lib/testing.php | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/engine/lib/testing.php b/engine/lib/testing.php index afa5dd2e2..6af96d8cf 100644 --- a/engine/lib/testing.php +++ b/engine/lib/testing.php @@ -52,6 +52,27 @@ $this->details = $details; $this->debug = $debug; } + + /** + * Successful execution or not? + * + * @return bool + */ + public function isSuccess() { return $this->successful; } + + /** + * Retrieve details. + * + * @return string + */ + public function getDetails() { return $this->details; } + + /** + * Retrieve debug. + * + * @return string + */ + public function getDebug() { return $this->debug; } /** * Factory function to generate a successful result. @@ -73,10 +94,12 @@ */ function execute_elgg_test($function) { - if (is_callable($function)) - return $function(); + global $ELGG_TEST_REGISTRY; + + if ((is_callable($function)) && (isset($ELGG_TEST_REGISTRY[$function]))) // must be callable, and registered (for security) + return array('function' => $function, 'result' => $function()); - return false; + return array('function' => $function, 'result' => false); } /** @@ -113,4 +136,15 @@ $ELGG_TEST_REGISTRY[$function] = $description; } + /** + * Return a list of available tests. + * + * @return array + */ + function get_available_tests() + { + global $ELGG_TEST_REGISTRY; + + return $ELGG_TEST_REGISTRY; + } ?>
\ No newline at end of file |