From 2e2692facdb18a5afd26dde4f263239904ac140b Mon Sep 17 00:00:00 2001 From: abhinavgandham Date: Thu, 22 Jan 2026 16:25:22 +1000 Subject: [PATCH] Removed maintanance mode tests. --- tests/dml/installation_test.php | 1 - tests/dml/outagedb_test.php | 5 ---- tests/local/outagelib_test.php | 47 --------------------------------- 3 files changed, 53 deletions(-) diff --git a/tests/dml/installation_test.php b/tests/dml/installation_test.php index 0a253ac..7fd5f5a 100644 --- a/tests/dml/installation_test.php +++ b/tests/dml/installation_test.php @@ -69,7 +69,6 @@ final class installation_test extends \auth_outage\base_testcase { outagedb::save($outage); $text = trim(ob_get_contents()); ob_end_clean(); - self::assertStringContainsString('Update maintenance mode configuration', $text); self::assertSame(1, $DB->count_records_select('event', "eventtype = 'auth_outage'", null)); // Uninstall plugin. diff --git a/tests/dml/outagedb_test.php b/tests/dml/outagedb_test.php index 33e1cbf..ac077e4 100644 --- a/tests/dml/outagedb_test.php +++ b/tests/dml/outagedb_test.php @@ -150,7 +150,6 @@ final class outagedb_test extends \auth_outage\base_testcase { public function test_finish(): void { $now = time(); $this->resetAfterTest(true); - $this->expectOutputRegex('/Update maintenance mode configuration\..*Updating maintenance mode configuration complete\./s'); // Create it. $id = self::saveoutage($now, -3, -2, 2, 'An ongoing outage.'); $outage = outagedb::get_by_id($id); @@ -229,7 +228,6 @@ final class outagedb_test extends \auth_outage\base_testcase { */ public function test_getactive(): void { $this->resetAfterTest(true); - $this->expectOutputRegex('/Update maintenance mode configuration\..*Updating maintenance mode configuration complete\./s'); // Have a consistent time for now (no seconds variation), helps debugging. $now = time(); @@ -288,7 +286,6 @@ final class outagedb_test extends \auth_outage\base_testcase { */ public function test_getallunended(): void { $this->resetAfterTest(true); - $this->expectOutputRegex('/Update maintenance mode configuration\..*Updating maintenance mode configuration complete\./s'); // Have a consistent time for now (no seconds variation), helps debugging. $now = time(); @@ -364,7 +361,6 @@ final class outagedb_test extends \auth_outage\base_testcase { */ public function test_getallended(): void { $this->resetAfterTest(true); - $this->expectOutputRegex('/Update maintenance mode configuration\..*Updating maintenance mode configuration complete\./s'); // Have a consistent time for now (no seconds variation), helps debugging. $now = time(); @@ -495,7 +491,6 @@ final class outagedb_test extends \auth_outage\base_testcase { */ public function test_finish_notongoing(): void { $this->resetAfterTest(true); - $this->expectOutputRegex('/Update maintenance mode configuration\..*Updating maintenance mode configuration complete\./s'); $time = time(); $outage = new outage([ 'warntime' => $time + (60 * 60 * 24 * 1), diff --git a/tests/local/outagelib_test.php b/tests/local/outagelib_test.php index cd06e78..49e38a6 100644 --- a/tests/local/outagelib_test.php +++ b/tests/local/outagelib_test.php @@ -33,44 +33,6 @@ require_once(__DIR__ . '/../base_testcase.php'); * @covers \auth_outage\local\outagelib */ final class outagelib_test extends \auth_outage\base_testcase { - /** - * Check if maintenance message is disabled as needed. - */ - public function test_maintenancemessage(): void { - $this->resetAfterTest(true); - static::setAdminUser(); - - $now = time(); - $outage = new outage([ - 'warntime' => $now, - 'starttime' => $now + 100, - 'stoptime' => $now + 200, - 'title' => 'Title', - 'description' => 'Description', - ]); - - set_config('maintenance_message', 'A message.'); - ob_start(); - outagedb::save($outage); - $text = trim(ob_get_contents()); - ob_end_clean(); - self::assertStringContainsString('Update maintenance mode configuration', $text); - self::assertFalse((bool)get_config('moodle', 'maintenance_message')); - self::assertCount(2, $this->getDebuggingMessages()); - $this->resetDebugging(); - } - - /** - * Check if maintenance later is removed if no outage set. - */ - public function test_maintenancelater_nonext(): void { - $this->resetAfterTest(true); - set_config('maintenance_later', time() + (60 * 60 * 24 * 7)); // In 1 week. - self::assertNotEmpty(get_config('moodle', 'maintenance_later')); - outagelib::prepare_next_outage(); - self::assertEmpty(get_config('moodle', 'maintenance_later')); - } - /** * Check outagelib::inject() works as expected. */ @@ -91,7 +53,6 @@ final class outagelib_test extends \auth_outage\base_testcase { $outage->id = outagedb::save($outage); $text = trim(ob_get_contents()); ob_end_clean(); - self::assertStringContainsString('Update maintenance mode configuration', $text); outagelib::reset_injectcalled(); // Get full header to avoid interactions with other single inject plugins. @@ -136,7 +97,6 @@ final class outagelib_test extends \auth_outage\base_testcase { $outage->id = outagedb::save($outage); $text = trim(ob_get_contents()); ob_end_clean(); - self::assertStringContainsString('Update maintenance mode configuration', $text); $_GET = ['auth_outage_preview' => (string)$outage->id]; @@ -178,7 +138,6 @@ final class outagelib_test extends \auth_outage\base_testcase { $outage->id = outagedb::save($outage); $text = trim(ob_get_contents()); ob_end_clean(); - self::assertStringContainsString('Update maintenance mode configuration', $text); $_GET = ['auth_outage_preview' => (string)$outage->id, 'auth_outage_delta' => '500']; outagelib::reset_injectcalled(); $header = outagelib::get_inject_code(); @@ -284,7 +243,6 @@ final class outagelib_test extends \auth_outage\base_testcase { $outage->id = outagedb::save($outage); $text = trim(ob_get_contents()); ob_end_clean(); - self::assertStringContainsString('Update maintenance mode configuration', $text); // Pretend we are there... $_SERVER['SCRIPT_FILENAME'] = '/var/www/alternativepath/admin/settings.php'; // Issue #88 regression test. @@ -529,8 +487,6 @@ EOT; public function test_when_we_change_allowed_ips_in_settings_it_updates_the_templates(): void { global $CFG; - $this->expectOutputRegex('/Update maintenance mode configuration\..*Updating maintenance mode configuration complete\./s'); - $this->create_outage(); // Change settings. @@ -549,8 +505,6 @@ EOT; public function test_when_we_change_remove_selectors_in_settings_it_updates_the_templates(): void { global $CFG; - $this->expectOutputRegex('/Update maintenance mode configuration\..*Updating maintenance mode configuration complete\./s'); - $this->create_outage(); // Change settings. @@ -583,7 +537,6 @@ EOT; $outage->id = outagedb::save($outage); $text = trim(ob_get_contents()); ob_end_clean(); - self::assertStringContainsString('Update maintenance mode configuration', $text); // Pretend we are there... $_SERVER['SCRIPT_FILENAME'] = '/var/www/alternativepath/admin/settings.php'; // Issue #88 regression test. $_SERVER['SCRIPT_NAME'] = '/admin/settings.php';