From e1d7d2d3f48a94df8c38a84b89c2ea2fb3e37cd3 Mon Sep 17 00:00:00 2001 From: Gus Auwerda Date: Mon, 21 Dec 2020 16:24:06 +1300 Subject: [PATCH] auth_outage: Update function calls to conform to PHPUnit 9 deprecations --- tests/phpunit/installation_test.php | 2 +- tests/phpunit/local/cli/cli_test.php | 4 ++-- tests/phpunit/local/cli/create_test.php | 12 +++++----- tests/phpunit/local/cli/finish_test.php | 4 ++-- tests/phpunit/local/cli/waitforit_test.php | 20 ++++++++--------- .../local/controllers/infopage_test.php | 2 +- .../maintenance_static_page_test.php | 22 +++++++++---------- tests/phpunit/local/outagelib_test.php | 8 +++---- 8 files changed, 37 insertions(+), 37 deletions(-) diff --git a/tests/phpunit/installation_test.php b/tests/phpunit/installation_test.php index d0636ae..49ed6b0 100644 --- a/tests/phpunit/installation_test.php +++ b/tests/phpunit/installation_test.php @@ -71,7 +71,7 @@ class installation_test extends auth_outage_base_testcase { $progress = new progress_trace_buffer(new text_progress_trace(), false); core_plugin_manager::instance()->uninstall_plugin('auth_outage', $progress); $progress->finished(); - self::assertContains('++ Success ++', $progress->get_buffer()); + self::assertStringContainsString('++ Success ++', $progress->get_buffer()); // Check ... self::assertSame(0, $DB->count_records_select('event', "eventtype = 'auth_outage'", null), diff --git a/tests/phpunit/local/cli/cli_test.php b/tests/phpunit/local/cli/cli_test.php index d589ccf..4cab5c6 100644 --- a/tests/phpunit/local/cli/cli_test.php +++ b/tests/phpunit/local/cli/cli_test.php @@ -81,8 +81,8 @@ class cli_test extends auth_outage_cli_testcase { $this->set_parameters(['-h']); $cli = new create(); $output = $this->execute($cli); - self::assertContains('-h', $output); - self::assertContains('--help', $output); + self::assertStringContainsString('-h', $output); + self::assertStringContainsString('--help', $output); } /** diff --git a/tests/phpunit/local/cli/create_test.php b/tests/phpunit/local/cli/create_test.php index 4e8d707..e944bce 100644 --- a/tests/phpunit/local/cli/create_test.php +++ b/tests/phpunit/local/cli/create_test.php @@ -120,8 +120,8 @@ class create_test extends auth_outage_cli_testcase { $this->set_parameters(['--help']); $cli = new create(); $output = $this->execute($cli); - self::assertContains('Creates', $output); - self::assertContains('--help', $output); + self::assertStringContainsString('Creates', $output); + self::assertStringContainsString('--help', $output); } /** @@ -157,7 +157,7 @@ class create_test extends auth_outage_cli_testcase { $cli = new create(); $cli->set_referencetime($now); $text = $this->execute($cli); - self::assertContains('created', $text); + self::assertStringContainsString('created', $text); // Check creted outage. list(, $id) = explode(':', $text); $id = (int)$id; @@ -221,7 +221,7 @@ class create_test extends auth_outage_cli_testcase { 'description' => 'Default Description', ]); $text = $this->execute($cli); - self::assertContains('created', $text); + self::assertStringContainsString('created', $text); // Check creted outage. list(, $id) = explode(':', $text); $id = (int)$id; @@ -299,8 +299,8 @@ class create_test extends auth_outage_cli_testcase { $cli = new create(); $cli->set_referencetime($now); $text = $this->execute($cli); - self::assertContains('created', $text); - self::assertContains('started', $text); + self::assertStringContainsString('created', $text); + self::assertStringContainsString('started', $text); } /** diff --git a/tests/phpunit/local/cli/finish_test.php b/tests/phpunit/local/cli/finish_test.php index ee97767..a2c290d 100644 --- a/tests/phpunit/local/cli/finish_test.php +++ b/tests/phpunit/local/cli/finish_test.php @@ -72,8 +72,8 @@ class finish_test extends auth_outage_cli_testcase { $this->set_parameters(['--help']); $cli = new finish(); $text = $this->execute($cli); - self::assertContains('Finishes', $text); - self::assertContains('--help', $text); + self::assertStringContainsString('Finishes', $text); + self::assertStringContainsString('--help', $text); } /** diff --git a/tests/phpunit/local/cli/waitforit_test.php b/tests/phpunit/local/cli/waitforit_test.php index 419e8be..9b0d93c 100644 --- a/tests/phpunit/local/cli/waitforit_test.php +++ b/tests/phpunit/local/cli/waitforit_test.php @@ -78,8 +78,8 @@ class waitforit_test extends auth_outage_cli_testcase { $this->set_parameters(['--help']); $cli = new waitforit(); $text = $this->execute($cli); - self::assertContains('Waits', $text); - self::assertContains('--help', $text); + self::assertStringContainsString('Waits', $text); + self::assertStringContainsString('--help', $text); } /** @@ -151,9 +151,9 @@ class waitforit_test extends auth_outage_cli_testcase { $cli = new waitforit(); $cli->set_referencetime($now); $output = $this->execute($cli); - self::assertContains('Verbose mode', $output); - self::assertContains('starting in 1 sec', $output); - self::assertContains('started', $output); + self::assertStringContainsString('Verbose mode', $output); + self::assertStringContainsString('starting in 1 sec', $output); + self::assertStringContainsString('started', $output); } /** @@ -178,11 +178,11 @@ class waitforit_test extends auth_outage_cli_testcase { return $now; }); $output = $this->execute($cli); - self::assertContains("starting in 45", $output); - self::assertContains("sleep 30 second", $output); - self::assertContains("starting in 15", $output); - self::assertContains("sleep 15 second", $output); - self::assertContains("started!", $output); + self::assertStringContainsString("starting in 45", $output); + self::assertStringContainsString("sleep 30 second", $output); + self::assertStringContainsString("starting in 15", $output); + self::assertStringContainsString("sleep 15 second", $output); + self::assertStringContainsString("started!", $output); } /** diff --git a/tests/phpunit/local/controllers/infopage_test.php b/tests/phpunit/local/controllers/infopage_test.php index bcaf9a4..881320f 100644 --- a/tests/phpunit/local/controllers/infopage_test.php +++ b/tests/phpunit/local/controllers/infopage_test.php @@ -103,7 +103,7 @@ class infopagecontroller_test extends auth_outage_base_testcase { ]); $info = new infopage(['outage' => $outage]); $output = $info->get_output(); - self::assertContains('auth_outage_info', $output); + self::assertStringContainsString('auth_outage_info', $output); } /** diff --git a/tests/phpunit/local/controllers/maintenance_static_page_test.php b/tests/phpunit/local/controllers/maintenance_static_page_test.php index cd8f575..fffdfad 100644 --- a/tests/phpunit/local/controllers/maintenance_static_page_test.php +++ b/tests/phpunit/local/controllers/maintenance_static_page_test.php @@ -104,9 +104,9 @@ class maintenance_static_page_test extends auth_outage_base_testcase { 'Content'; $generated = $this->generated_page_html($html); - self::assertContains('www.example.com/moodle/auth/outage/file.php?file=', $generated); + self::assertStringContainsString('www.example.com/moodle/auth/outage/file.php?file=', $generated); self::assertNotContains($localcsslink, $generated); - self::assertContains($externalcsslink, $generated); + self::assertStringContainsString($externalcsslink, $generated); } /** @@ -174,9 +174,9 @@ class maintenance_static_page_test extends auth_outage_base_testcase { 'Content'; $generated = $this->generated_page_html($html); - self::assertContains('www.example.com/moodle/auth/outage/file.php?file=', $generated); + self::assertStringContainsString('www.example.com/moodle/auth/outage/file.php?file=', $generated); self::assertNotContains($localimglink, $generated); - self::assertContains($externalimglink, $generated); + self::assertStringContainsString($externalimglink, $generated); } /** @@ -190,7 +190,7 @@ class maintenance_static_page_test extends auth_outage_base_testcase { $generated = $this->generated_page_html($html); self::assertNotContains($link, $generated); - self::assertContains('www.example.com/moodle/auth/outage/file.php?file=', $generated); + self::assertStringContainsString('www.example.com/moodle/auth/outage/file.php?file=', $generated); } /** @@ -207,7 +207,7 @@ class maintenance_static_page_test extends auth_outage_base_testcase { $generated = trim(file_get_contents($page->get_io()->get_template_file())); self::assertNotContains($link, $generated); - self::assertContains('www.example.com/moodle/auth/outage/file.php?file=preview%2F', $generated); + self::assertStringContainsString('www.example.com/moodle/auth/outage/file.php?file=preview%2F', $generated); } /** @@ -303,7 +303,7 @@ class maintenance_static_page_test extends auth_outage_base_testcase { */ public function test_get_url_for_file() { $io = new maintenance_static_page_io(); - self::assertContains('www.example.com/moodle/auth/outage/file.php?file=img.png', $io->get_url_for_file('img.png')); + self::assertStringContainsString('www.example.com/moodle/auth/outage/file.php?file=img.png', $io->get_url_for_file('img.png')); } /** @@ -457,8 +457,8 @@ class maintenance_static_page_test extends auth_outage_base_testcase { set_config('remove_selectors', '#invalidid', 'auth_outage'); $generated = $this->generated_page_html($html); - self::assertContains('removeme', $generated); - self::assertContains('Goodbye cruel world', $generated); + self::assertStringContainsString('removeme', $generated); + self::assertStringContainsString('Goodbye cruel world', $generated); } /** @@ -472,7 +472,7 @@ class maintenance_static_page_test extends auth_outage_base_testcase { set_config('remove_selectors', '#invalidid', 'auth_outage'); $generated = $this->generated_page_html($html); - self::assertContains('', $generated); + self::assertStringContainsString('', $generated); } /** @@ -490,7 +490,7 @@ class maintenance_static_page_test extends auth_outage_base_testcase { $generated = trim(file_get_contents($page->get_io()->get_template_file())); return $generated; - self::assertContains('', $generated); + self::assertStringContainsString('', $generated); } /** diff --git a/tests/phpunit/local/outagelib_test.php b/tests/phpunit/local/outagelib_test.php index 4ff8567..729037b 100644 --- a/tests/phpunit/local/outagelib_test.php +++ b/tests/phpunit/local/outagelib_test.php @@ -99,8 +99,8 @@ class outagelib_test extends auth_outage_base_testcase { outagelib::reset_injectcalled(); // Get full header to avoid interactions with other single inject plugins. $header1 = $OUTPUT->standard_top_of_body_html(); - self::assertContains('