aboutsummaryrefslogtreecommitdiff
path: root/vendors/simpletest/extensions/testdox.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-02 18:40:04 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-02 18:40:04 +0000
commit322bb9cd2be9e51422cb2b82684692e825c2bfb7 (patch)
tree1e8e75c1ff0c47d6eda9db114a13dfa2b83adf72 /vendors/simpletest/extensions/testdox.php
parent4ffb02ad9c1b95013a0fbf97cefde827600ecc3f (diff)
downloadelgg-322bb9cd2be9e51422cb2b82684692e825c2bfb7.tar.gz
elgg-322bb9cd2be9e51422cb2b82684692e825c2bfb7.tar.bz2
Added simpletest and start of unit tests.
git-svn-id: http://code.elgg.org/elgg/trunk@3503 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'vendors/simpletest/extensions/testdox.php')
-rwxr-xr-xvendors/simpletest/extensions/testdox.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/vendors/simpletest/extensions/testdox.php b/vendors/simpletest/extensions/testdox.php
new file mode 100755
index 000000000..7db7c872c
--- /dev/null
+++ b/vendors/simpletest/extensions/testdox.php
@@ -0,0 +1,42 @@
+<?php
+
+class TestDoxReporter extends SimpleReporter
+{
+ var $_test_case_pattern = '/^TestOf(.*)$/';
+
+ function TestDoxReporter($test_case_pattern = '/^TestOf(.*)$/') {
+ parent::SimpleScorer();
+ $this->_test_case_pattern = empty($test_case_pattern) ? '/^(.*)$/' : $test_case_pattern;
+ }
+
+ function paintCaseStart($test_name) {
+ preg_match($this->_test_case_pattern, $test_name, $matches);
+ if (!empty($matches[1])) {
+ echo $matches[1] . "\n";
+ } else {
+ echo $test_name . "\n";
+ }
+ }
+
+ function paintCaseEnd() {
+ echo "\n";
+ }
+
+ function paintMethodStart($test_name) {
+ if (!preg_match('/^test(.*)$/i', $test_name, $matches)) {
+ return;
+ }
+ $test_name = $matches[1];
+
+ $test_name = preg_replace('/([A-Z])([A-Z])/', '$1 $2', $test_name);
+ echo '- ' . strtolower(preg_replace('/([a-zA-Z])([A-Z0-9])/', '$1 $2', $test_name));
+ }
+
+ function paintMethodEnd() {
+ echo "\n";
+ }
+
+ function paintFail() {
+ echo " [FAILED]";
+ }
+}