]> git.mjollnir.org Git - moodle.git/commitdiff
Unit tests: show total time taken to run the tests.
authortjhunt <tjhunt>
Tue, 23 Jun 2009 10:34:21 +0000 (10:34 +0000)
committertjhunt <tjhunt>
Tue, 23 Jun 2009 10:34:21 +0000 (10:34 +0000)
admin/report/unittest/ex_reporter.php
lang/en_utf8/simpletest.php

index 355926876786166fd50d2c9e3218f6f71fc477c0..27a95ebc59ed2fe64b2279f5cb18c16e36bbe2c2 100644 (file)
@@ -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 '</div>';
 
         echo '<div class="performanceinfo">',
-                $this->get_string('runat', date('<b>d-m-Y H:i T</b>')),
+                $this->get_string('runat', userdate($this->timestart)), ' ',
+                $this->get_string('timetakes', format_time(time() - $this->timestart)), ' ',
                 $this->get_string('version', SimpleTestOptions::getVersion()),
                 '</div>';
     }
index 7645345cff4125a9922dec7273dc44ccb4f9fbae..7cd7f42ee84e447f430a743135b16c483cc9dde0 100644 (file)
@@ -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.';