diff --git a/cake/tests/lib/cake_text_reporter.php b/cake/tests/lib/cake_text_reporter.php new file mode 100644 index 00000000000..1d142464158 --- /dev/null +++ b/cake/tests/lib/cake_text_reporter.php @@ -0,0 +1,60 @@ +_timeStart)) { + $this->_timeStart = $this->_getTime(); + } + parent::paintGroupStart($test_name, $size); + } + +/** + * Signals/Paints the end of a TestSuite. All test cases have run + * and timers are stopped. + * + * @return void + **/ + function paintGroupEnd($test_name) { + $this->_timeEnd = $this->_getTime(); + $this->_timeDuration = $this->_timeEnd - $this->_timeStart; + parent::paintGroupEnd($test_name); + } + +/** + * Get the current time in microseconds. Similar to getMicrotime in basics.php + * but in a separate function to reduce dependancies. + * + * @return float Time in microseconds + **/ + function _getTime() { + list($usec, $sec) = explode(' ', microtime()); + return ((float)$sec + (float)$usec); + } + +/** + * Paints the end of the test with a summary of + * the passes and failures. + * + * @param string $test_name Name class of test. + * @access public + */ + function paintFooter($test_name) { + parent::paintFooter($test_name); + echo 'Time taken by tests (in seconds): ' . $this->_timeDuration . "\n"; + if (function_exists('memory_get_peak_usage')) { + echo 'Peak memory use: (in bytes): ' . number_format(memory_get_peak_usage()) . "\n"; + } + } +} +?> \ No newline at end of file diff --git a/cake/tests/lib/code_coverage_manager.php b/cake/tests/lib/code_coverage_manager.php index 3ccee53f98f..3bdbb28f4d1 100644 --- a/cake/tests/lib/code_coverage_manager.php +++ b/cake/tests/lib/code_coverage_manager.php @@ -790,4 +790,4 @@ function __array_strpos($arr, $needle, $reverse = false) { return false; } } -?> \ No newline at end of file +?> diff --git a/cake/tests/lib/test_manager.php b/cake/tests/lib/test_manager.php index 596c8da3a73..1e4717bf213 100644 --- a/cake/tests/lib/test_manager.php +++ b/cake/tests/lib/test_manager.php @@ -637,7 +637,8 @@ function &CakeTestsGetReporter() { $Reporter =& new CakeHtmlReporter(); break; default: - $Reporter =& new TextReporter(); + require_once CAKE_TESTS_LIB . 'cake_text_reporter.php'; + $Reporter =& new CakeTextReporter(); break; } }