mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'w15_MDL-38989_m25_ttfinal' of git://github.com/skodak/moodle
This commit is contained in:
commit
b812305ef6
@ -636,6 +636,9 @@ class core_course_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Check that the course has been duplicated.
|
||||
$this->assertEquals($newcourse['shortname'], $duplicate['shortname']);
|
||||
|
||||
// Reset the timeouts.
|
||||
set_time_limit(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,7 +97,7 @@ abstract class advanced_testcase extends PHPUnit_Framework_TestCase {
|
||||
phpunit_util::reset_all_database_sequences();
|
||||
phpunit_util::$lastdbwrites = $DB->perf_get_writes(); // no db reset necessary
|
||||
}
|
||||
phpunit_util::reset_all_data();
|
||||
phpunit_util::reset_all_data(null);
|
||||
|
||||
} else if ($this->resetAfterTest === false) {
|
||||
if ($this->testdbtransaction) {
|
||||
|
@ -130,7 +130,7 @@ abstract class database_driver_testcase extends PHPUnit_Framework_TestCase {
|
||||
self::$extradb->dispose();
|
||||
self::$extradb = null;
|
||||
}
|
||||
phpunit_util::reset_all_data();
|
||||
phpunit_util::reset_all_data(null);
|
||||
parent::tearDownAfterClass();
|
||||
}
|
||||
|
||||
|
@ -83,10 +83,13 @@ class phpunit_util extends testing_util {
|
||||
* Note: this is relatively slow (cca 2 seconds for pg and 7 for mysql) - please use with care!
|
||||
*
|
||||
* @static
|
||||
* @param bool $logchanges log changes in global state and database in error log
|
||||
* @param bool $detectchanges
|
||||
* true - changes in global state and database are reported as errors
|
||||
* false - no errors reported
|
||||
* null - only critical problems are reported as errors
|
||||
* @return void
|
||||
*/
|
||||
public static function reset_all_data($logchanges = false) {
|
||||
public static function reset_all_data($detectchanges = false) {
|
||||
global $DB, $CFG, $USER, $SITE, $COURSE, $PAGE, $OUTPUT, $SESSION;
|
||||
|
||||
// Stop any message redirection.
|
||||
@ -110,7 +113,7 @@ class phpunit_util extends testing_util {
|
||||
$resetdb = self::reset_database();
|
||||
$warnings = array();
|
||||
|
||||
if ($logchanges) {
|
||||
if ($detectchanges === true) {
|
||||
if ($resetdb) {
|
||||
$warnings[] = 'Warning: unexpected database modification, resetting DB state';
|
||||
}
|
||||
@ -147,8 +150,9 @@ class phpunit_util extends testing_util {
|
||||
// libraries to mess with timeouts unintentionally.
|
||||
// Our PHPUnit integration is not supposed to change it either.
|
||||
|
||||
// TODO: MDL-38912 uncomment and fix all + somehow resolve timeouts in failed tests.
|
||||
//$warnings[] = 'Warning: max_execution_time was changed.';
|
||||
if ($detectchanges !== false) {
|
||||
$warnings[] = 'Warning: max_execution_time was changed to '.ini_get('max_execution_time');
|
||||
}
|
||||
set_time_limit(0);
|
||||
}
|
||||
|
||||
|
@ -111,6 +111,11 @@ class statslib_daily_testcase extends advanced_testcase {
|
||||
$this->resetAfterTest(true);
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
// Reset the timeouts.
|
||||
set_time_limit(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to setup database.
|
||||
*
|
||||
|
@ -40,6 +40,11 @@ require_once($CFG->dirroot . '/mod/assign/tests/base_test.php');
|
||||
*/
|
||||
class mod_assign_upgradelib_testcase extends mod_assign_base_testcase {
|
||||
|
||||
protected function tearDown() {
|
||||
// Reset the timeouts.
|
||||
set_time_limit(0);
|
||||
}
|
||||
|
||||
public function test_upgrade_upload_assignment() {
|
||||
global $DB;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user