WR #343135: Update tests to work with T12.

For some reason, $this->resetAfterTest(true); is not resetting the outage table in T12 (probably T11/13 too)
This commit is contained in:
Nicholas Hoobin
2020-09-11 15:43:52 +10:00
parent d9b29d2335
commit 2b249ac036
2 changed files with 12 additions and 1 deletions

View File

@@ -31,6 +31,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use auth_outage\dml\outagedb;
defined('MOODLE_INTERNAL') || die();
/**
@@ -70,4 +72,12 @@ abstract class auth_outage_base_testcase extends advanced_testcase {
parent::setUp();
$this->resetAfterTest(true);
}
public function tearDown() {
global $DB;
foreach (outagedb::get_all() as $i => $outage) {
$DB->delete_records('auth_outage', ['id' => $outage->id]);
}
}
}

View File

@@ -31,6 +31,7 @@ defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->libdir.'/adminlib.php');
require_once(__DIR__.'/../base_testcase.php');
/**
* outagelib_test test class.
@@ -41,7 +42,7 @@ require_once($CFG->libdir.'/adminlib.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @SuppressWarnings(public) Allow as many methods as needed.
*/
class outagelib_test extends advanced_testcase {
class outagelib_test extends auth_outage_base_testcase {
/**
* Check if maintenance message is disabled as needed.
*/