Merge branch 'w14_MDL-32250_m23_simpletest110' of git://github.com/skodak/moodle

This commit is contained in:
Dan Poltawski 2012-04-02 16:15:35 +08:00
commit 8408d23c99
88 changed files with 17451 additions and 5860 deletions

View file

@ -55,8 +55,8 @@ class ExHtmlReporter extends HtmlReporter {
*
* @param bool $showpasses Whether this reporter should output anything for passes.
*/
function ExHtmlReporter($showpasses) {
$this->HtmlReporter();
function __construct($showpasses) {
parent::__construct('UTF-8');
$this->showpasses = $showpasses;
$this->strrunonlyfolder = $this->get_string('runonlyfolder');
@ -254,7 +254,7 @@ class ExHtmlReporter extends HtmlReporter {
echo '<div class="performanceinfo">',
$this->get_string('runat', userdate($this->timestart)), ' ',
$this->get_string('timetakes', format_time(time() - $this->timestart)), ' ',
$this->get_string('version', SimpleTestOptions::getVersion()),
$this->get_string('version', SimpleTest::getVersion()),
'</div>';
}

View file

@ -46,7 +46,7 @@ class AutoGroupTest extends TestSuite {
$this->showsearch = $showsearch;
}
function run(&$reporter) {
function run($reporter) {
global $UNITTEST;
$UNITTEST->running = true;
@ -85,7 +85,7 @@ class AutoGroupTest extends TestSuite {
$s_count++;
// OK, found: this shows as a 'Notice' for any 'simpletest/test*.php' file.
$this->addTestCase(new FindFileNotice($file_path, 'Found unit test file, '. $s_count));
$this->add(new FindFileNotice($file_path, 'Found unit test file, '. $s_count));
// addTestFile: Unfortunately this doesn't return fail/success (bool).
$this->addTestFile($file_path, true);
@ -105,9 +105,9 @@ class AutoGroupTest extends TestSuite {
$path = $dir;
$count = $this->_recurseFolders($path);
if ($count <= 0) {
$this->addTestCase(new BadAutoGroupTest($path, 'Search complete. No unit test files found'));
$this->add(new BadAutoGroupTest($path, 'Search complete. No unit test files found'));
} else {
$this->addTestCase(new AutoGroupTestNotice($path, 'Search complete. Total unit test files found: '. $count));
$this->add(new AutoGroupTestNotice($path, 'Search complete. Total unit test files found: '. $count));
}
if ($this->showsearch) {
echo '</ul>';
@ -116,6 +116,7 @@ class AutoGroupTest extends TestSuite {
}
function addTestFile($file, $internalcall = false) {
if ($this->showsearch) {
if ($internalcall) {
echo '<li><b>' . basename($file) . '</b></li>';
@ -126,10 +127,10 @@ class AutoGroupTest extends TestSuite {
// get blank screens because evil people turn down error_reporting elsewhere.
error_reporting(E_ALL);
}
if(!is_file($file) ){
parent::addTestCase(new BadTest($file, 'Not a file or does not exist'));
if (!is_file($file) ){
parent::add(new BadTest($file, 'Not a file or does not exist'));
}
parent::addTestFile($file);
parent::addFile($file);
}
}

View file

@ -123,7 +123,7 @@ class autogroup_test_coverage extends AutoGroupTest {
* automatically generating the coverage report. Only supports one instrumentation
* to be executed and reported.
*/
public function run(&$simpletestreporter) {
public function run($simpletestreporter) {
global $CFG;
if (moodle_coverage_recorder::can_run_codecoverage() && $this->performcoverage) {
@ -148,7 +148,7 @@ class autogroup_test_coverage extends AutoGroupTest {
* allowing further process of coverage data once tests are over. Supports multiple
* instrumentations (code coverage gathering sessions) to be executed.
*/
public function run_with_external_coverage(&$simpletestreporter, &$covrecorder) {
public function run_with_external_coverage($simpletestreporter, $covrecorder) {
if (moodle_coverage_recorder::can_run_codecoverage() && $this->performcoverage) {
$covrecorder->setIncludePaths($this->includecoverage);

View file

@ -82,8 +82,8 @@ function recurseFolders($path, $callback, $fileregexp = '/.*/', $exclude = false
class IgnoreWhitespaceExpectation extends SimpleExpectation {
var $expect;
function IgnoreWhitespaceExpectation($content, $message = '%s') {
$this->SimpleExpectation($message);
function __construct($content, $message = '%s') {
parent::__construct($message);
$this->expect=$this->normalise($content);
}
@ -111,8 +111,8 @@ class IgnoreWhitespaceExpectation extends SimpleExpectation {
class ArraysHaveSameValuesExpectation extends SimpleExpectation {
var $expect;
function ArraysHaveSameValuesExpectation($expected, $message = '%s') {
$this->SimpleExpectation($message);
function __construct($expected, $message = '%s') {
parent::__construct($message);
if (!is_array($expected)) {
trigger_error('Attempt to create an ArraysHaveSameValuesExpectation ' .
'with an expected value that is not an array.');
@ -149,8 +149,8 @@ class ArraysHaveSameValuesExpectation extends SimpleExpectation {
class CheckSpecifiedFieldsExpectation extends SimpleExpectation {
var $expect;
function CheckSpecifiedFieldsExpectation($expected, $message = '%s') {
$this->SimpleExpectation($message);
function __construct($expected, $message = '%s') {
parent::__construct($message);
if (!is_object($expected)) {
trigger_error('Attempt to create a CheckSpecifiedFieldsExpectation ' .
'with an expected value that is not an object.');
@ -651,7 +651,7 @@ class UnitTestCaseUsingDatabase extends UnitTestCase {
}
// Only do this after the above text.
parent::UnitTestCase($label);
parent::__construct($label);
// Create the test DB instance.
$this->realdb = $DB;
@ -974,7 +974,7 @@ class FakeDBUnitTestCase extends UnitTestCase {
return;
}
parent::UnitTestCase($label);
parent::__construct($label);
// MDL-16483 Get PKs and save data to text file
$this->pkfile = $CFG->dataroot.'/testtablespks.csv';