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..8922dce 100644 --- a/tests/phpunit/local/controllers/maintenance_static_page_test.php +++ b/tests/phpunit/local/controllers/maintenance_static_page_test.php @@ -90,7 +90,7 @@ class maintenance_static_page_test extends auth_outage_base_testcase { maintenance_static_page::create_from_html($html)->generate(); $generated = $this->generated_page_html($html); - self::assertNotContains('Content'; $generated = $this->generated_page_html($html); - self::assertContains('www.example.com/moodle/auth/outage/file.php?file=', $generated); - self::assertNotContains($localcsslink, $generated); - self::assertContains($externalcsslink, $generated); + self::assertStringContainsString('www.example.com/moodle/auth/outage/file.php?file=', $generated); + self::assertStringNotContainsString($localcsslink, $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::assertNotContains($localimglink, $generated); - self::assertContains($externalimglink, $generated); + self::assertStringContainsString('www.example.com/moodle/auth/outage/file.php?file=', $generated); + self::assertStringNotContainsString($localimglink, $generated); + self::assertStringContainsString($externalimglink, $generated); } /** @@ -189,8 +189,8 @@ class maintenance_static_page_test extends auth_outage_base_testcase { 'Content'; $generated = $this->generated_page_html($html); - self::assertNotContains($link, $generated); - self::assertContains('www.example.com/moodle/auth/outage/file.php?file=', $generated); + self::assertStringNotContainsString($link, $generated); + self::assertStringContainsString('www.example.com/moodle/auth/outage/file.php?file=', $generated); } /** @@ -206,8 +206,8 @@ class maintenance_static_page_test extends auth_outage_base_testcase { $page->generate(); $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::assertStringNotContainsString($link, $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')); } /** @@ -370,8 +370,8 @@ class maintenance_static_page_test extends auth_outage_base_testcase { set_config('remove_selectors', '.removeme', 'auth_outage'); $generated = $this->generated_page_html($html); - self::assertNotContains('removeme', $generated); - self::assertNotContains('Goodbye cruel world', $generated); + self::assertStringNotContainsString('removeme', $generated); + self::assertStringNotContainsString('Goodbye cruel world', $generated); } /** @@ -385,8 +385,8 @@ class maintenance_static_page_test extends auth_outage_base_testcase { set_config('remove_selectors', '#removeme', 'auth_outage'); $generated = $this->generated_page_html($html); - self::assertNotContains('removeme', $generated); - self::assertNotContains('Goodbye cruel world', $generated); + self::assertStringNotContainsString('removeme', $generated); + self::assertStringNotContainsString('Goodbye cruel world', $generated); } /** @@ -403,9 +403,9 @@ class maintenance_static_page_test extends auth_outage_base_testcase { set_config('remove_selectors', ".removeme\n.deleteme", 'auth_outage'); $generated = $this->generated_page_html($html); - self::assertNotContains('removeme', $generated); - self::assertNotContains('deleteme', $generated); - self::assertNotContains('Goodbye cruel world', $generated); + self::assertStringNotContainsString('removeme', $generated); + self::assertStringNotContainsString('deleteme', $generated); + self::assertStringNotContainsString('Goodbye cruel world', $generated); } /** @@ -422,9 +422,9 @@ class maintenance_static_page_test extends auth_outage_base_testcase { set_config('remove_selectors', " .removeme \n .deleteme ", 'auth_outage'); $generated = $this->generated_page_html($html); - self::assertNotContains('removeme', $generated); - self::assertNotContains('deleteme', $generated); - self::assertNotContains('Goodbye cruel world', $generated); + self::assertStringNotContainsString('removeme', $generated); + self::assertStringNotContainsString('deleteme', $generated); + self::assertStringNotContainsString('Goodbye cruel world', $generated); } /** @@ -441,9 +441,9 @@ class maintenance_static_page_test extends auth_outage_base_testcase { set_config('remove_selectors', "\n\n.removeme\n\n\n\n.deleteme\n\n", 'auth_outage'); $generated = $this->generated_page_html($html); - self::assertNotContains('removeme', $generated); - self::assertNotContains('deleteme', $generated); - self::assertNotContains('Goodbye cruel world', $generated); + self::assertStringNotContainsString('removeme', $generated); + self::assertStringNotContainsString('deleteme', $generated); + self::assertStringNotContainsString('Goodbye cruel world', $generated); } /** @@ -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); } /** @@ -529,7 +529,7 @@ class maintenance_static_page_test extends auth_outage_base_testcase { $generator = new maintenance_static_page_generator(new DOMDocument(), new maintenance_static_page_io()); $matches = $generator->get_urls_from_stylesheet($filecontent); - self::assertInternalType('array', $matches); + self::assertIsArray($matches); self::assertCount(2, $matches); self::assertCount($count, $matches[1]); } diff --git a/tests/phpunit/local/outage_test.php b/tests/phpunit/local/outage_test.php index fd1d5a8..de3da63 100644 --- a/tests/phpunit/local/outage_test.php +++ b/tests/phpunit/local/outage_test.php @@ -280,11 +280,11 @@ class outage_test extends auth_outage_base_testcase { 'description' => 'Description {{start}} {{stop}} {{duration}}', ]); $title = $outage->get_title(); - self::assertNotContains('{', $title); - self::assertNotContains('}', $title); + self::assertStringNotContainsString('{', $title); + self::assertStringNotContainsString('}', $title); $description = $outage->get_description(); - self::assertNotContains('{', $description); - self::assertNotContains('}', $description); + self::assertStringNotContainsString('{', $description); + self::assertStringNotContainsString('}', $description); } /** diff --git a/tests/phpunit/local/outagelib_test.php b/tests/phpunit/local/outagelib_test.php index 4ff8567..597ac10 100644 --- a/tests/phpunit/local/outagelib_test.php +++ b/tests/phpunit/local/outagelib_test.php @@ -99,14 +99,14 @@ 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('