From c8f99a7bf3f8e32761bfa99f28c040ef2d53f718 Mon Sep 17 00:00:00 2001 From: Kristian Ringer Date: Wed, 8 May 2019 13:30:08 +1000 Subject: [PATCH] Fix unit tests in totara 10 - Change outagelib_test to use the auth_outage_base_testcase base class - Remove outages from test table in tearDown function after each test. --- tests/phpunit/base_testcase.php | 5 +++++ tests/phpunit/local/outagelib_test.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/base_testcase.php b/tests/phpunit/base_testcase.php index 91a03fd..7680c9f 100644 --- a/tests/phpunit/base_testcase.php +++ b/tests/phpunit/base_testcase.php @@ -74,4 +74,9 @@ abstract class auth_outage_base_testcase extends advanced_testcase { $CFG->wwwroot = 'http://www.example.com/moodle'; $CFG->httpswwwroot = $CFG->wwwroot; } + + public function tearDown() { + global $DB; + $DB->delete_records('auth_outage'); + } } diff --git a/tests/phpunit/local/outagelib_test.php b/tests/phpunit/local/outagelib_test.php index ba39c42..69b470f 100644 --- a/tests/phpunit/local/outagelib_test.php +++ b/tests/phpunit/local/outagelib_test.php @@ -41,7 +41,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. */