|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 class TestDoxReporter extends SimpleReporter 00004 { 00005 var $_test_case_pattern = '/^TestOf(.*)$/'; 00006 00007 function TestDoxReporter($test_case_pattern = '/^TestOf(.*)$/') { 00008 parent::SimpleScorer(); 00009 $this->_test_case_pattern = empty($test_case_pattern) ? '/^(.*)$/' : $test_case_pattern; 00010 } 00011 00012 function paintCaseStart($test_name) { 00013 preg_match($this->_test_case_pattern, $test_name, $matches); 00014 if (!empty($matches[1])) { 00015 echo $matches[1] . "\n"; 00016 } else { 00017 echo $test_name . "\n"; 00018 } 00019 } 00020 00021 function paintCaseEnd() { 00022 echo "\n"; 00023 } 00024 00025 function paintMethodStart($test_name) { 00026 if (!preg_match('/^test(.*)$/i', $test_name, $matches)) { 00027 return; 00028 } 00029 $test_name = $matches[1]; 00030 00031 $test_name = preg_replace('/([A-Z])([A-Z])/', '$1 $2', $test_name); 00032 echo '- ' . strtolower(preg_replace('/([a-zA-Z])([A-Z0-9])/', '$1 $2', $test_name)); 00033 } 00034 00035 function paintMethodEnd() { 00036 echo "\n"; 00037 } 00038 00039 function paintFail() { 00040 echo " [FAILED]"; 00041 } 00042 }