From: tjhunt Date: Tue, 23 Jun 2009 10:34:21 +0000 (+0000) Subject: Unit tests: show total time taken to run the tests. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=4ab836113a0775a9dd544be5429d777551f28124;p=moodle.git Unit tests: show total time taken to run the tests. --- diff --git a/admin/report/unittest/ex_reporter.php b/admin/report/unittest/ex_reporter.php index 3559268767..27a95ebc59 100644 --- a/admin/report/unittest/ex_reporter.php +++ b/admin/report/unittest/ex_reporter.php @@ -33,6 +33,8 @@ class ExHtmlReporter extends HtmlReporter { var $strseparator; + var $timestart; + /** * Constructor. * @@ -163,6 +165,7 @@ class ExHtmlReporter extends HtmlReporter { * Output anything that should appear above all the test output. */ function paintHeader($test_name) { + $this->timestart = time(); // We do this the moodle way instead. } @@ -187,7 +190,8 @@ class ExHtmlReporter extends HtmlReporter { echo ''; echo '
', - $this->get_string('runat', date('d-m-Y H:i T')), + $this->get_string('runat', userdate($this->timestart)), ' ', + $this->get_string('timetakes', format_time(time() - $this->timestart)), ' ', $this->get_string('version', SimpleTestOptions::getVersion()), '
'; } diff --git a/lang/en_utf8/simpletest.php b/lang/en_utf8/simpletest.php index 7645345cff..7cd7f42ee8 100644 --- a/lang/en_utf8/simpletest.php +++ b/lang/en_utf8/simpletest.php @@ -41,6 +41,7 @@ $string['testdboperations'] = 'Test Database operations'; $string['testtablesneedupgrade'] = 'The test DB tables need to be upgraded. Do you wish to proceed with the upgrade now?'; $string['testtablesok'] = 'The test DB tables were successfully installed.'; $string['testtablescsvfileunwritable'] = 'The test tables CSV file is not writable ($a->filename)'; +$string['timetakes'] = 'Time taken: $a.'; $string['thorough'] = 'Run a thorough test (may be slow).'; $string['updatingnoninsertedrecord'] = 'Trying to update a record that was not inserted by these unit tests (id $a->id in table $a->table).'; $string['uncaughtexception'] = 'Uncaught exception [{$a->getMessage()}] in [{$a->getFile()}:{$a->getLine()}] TESTS ABORTED.';