From 2b249ac03688da290bb136cd9f403e5291b13e62 Mon Sep 17 00:00:00 2001 From: Nicholas Hoobin Date: Fri, 11 Sep 2020 15:43:52 +1000 Subject: [PATCH 1/2] 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) --- tests/phpunit/base_testcase.php | 10 ++++++++++ tests/phpunit/local/outagelib_test.php | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/base_testcase.php b/tests/phpunit/base_testcase.php index 0e71ed1..307a0c4 100644 --- a/tests/phpunit/base_testcase.php +++ b/tests/phpunit/base_testcase.php @@ -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]); + } + } } diff --git a/tests/phpunit/local/outagelib_test.php b/tests/phpunit/local/outagelib_test.php index 0e04866..6fd2875 100644 --- a/tests/phpunit/local/outagelib_test.php +++ b/tests/phpunit/local/outagelib_test.php @@ -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. */ From 0efb9acbd1835a00eb57d529c15d7bbc9afb103b Mon Sep 17 00:00:00 2001 From: Nicholas Hoobin Date: Fri, 11 Sep 2020 16:04:04 +1000 Subject: [PATCH 2/2] Begin the song and dance of travis. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b2023cf..49eb20c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ services: addons: firefox: "47.0.1" - postgresql: "9.5" + postgresql: "9.6" apt: packages: - openjdk-8-jre