MDL-67673 phpunit: Remove deprecated assertContains() uses on strings
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 31 Aug 2020 22:44:13 +0000 (00:44 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 21 Oct 2020 10:46:05 +0000 (12:46 +0200)
Both assertContains() and assertNotContains() are deprecated in PHPUnit 8
for operations on strings. Also the optional case parameter is. All uses
must be changed to one of:

- assertStringContainsString()
- assertStringContainsStringIgnoringCase()
- assertStringNotContainsString()
- assertStringNotContainsStringIgnoringCase()

More info: https://github.com/sebastianbergmann/phpunit/issues/3422

Regexp to find all uses:

ag 'assert(Not)?Contains\('

113 files changed:
admin/tool/behat/tests/manager_util_test.php
admin/tool/dataprivacy/tests/api_test.php
admin/tool/dataprivacy/tests/privacy_provider_test.php
admin/tool/httpsreplace/tests/httpsreplace_test.php
admin/tool/mobile/tests/api_test.php
admin/tool/mobile/tests/externallib_test.php
admin/tool/monitor/tests/eventobservers_test.php
admin/tool/templatelibrary/tests/externallib_test.php
admin/tool/uploadcourse/tests/course_test.php
admin/tool/usertours/tests/privacy_provider_test.php
analytics/tests/dataset_manager_test.php
auth/oauth2/tests/auth_test.php
availability/condition/completion/tests/condition_test.php
availability/condition/date/tests/condition_test.php
availability/condition/grade/tests/condition_test.php
availability/condition/group/tests/condition_test.php
availability/condition/grouping/tests/condition_test.php
availability/condition/profile/tests/condition_test.php
availability/tests/info_test.php
availability/tests/tree_test.php
blocks/rss_client/tests/cron_test.php
blog/tests/events_test.php
cache/tests/cache_test.php
calendar/tests/events_test.php
calendar/tests/externallib_test.php
cohort/tests/externallib_test.php
competency/tests/event_test.php
competency/tests/external_test.php
competency/tests/lib_test.php
contentbank/contenttype/h5p/tests/contenttype_h5p_test.php
contentbank/tests/contentbank_test.php
contentbank/tests/contenttype_test.php
course/tests/courselib_test.php
course/tests/externallib_test.php
enrol/lti/tests/helper_test.php
enrol/lti/tests/sync_members_test.php
enrol/lti/tests/tool_provider_test.php
enrol/manual/tests/lib_test.php
enrol/self/tests/self_test.php
filter/mediaplugin/tests/filter_test.php
grade/tests/importlib_test.php
grade/tests/report_graderlib_test.php
h5p/tests/h5p_file_storage_test.php
h5p/tests/helper_test.php
lib/dml/tests/pgsql_native_recordset_test.php
lib/filestorage/tests/zip_packer_test.php
lib/form/tests/course_test.php
lib/form/tests/duration_test.php
lib/form/tests/filetypes_util_test.php
lib/form/tests/privacy_provider_test.php
lib/phpunit/tests/advanced_test.php
lib/tests/antivirus_test.php
lib/tests/authlib_test.php
lib/tests/completionlib_test.php
lib/tests/core_media_player_native.php
lib/tests/core_renderer_template_exploit_test.php
lib/tests/event_course_module_viewed.php
lib/tests/externallib_test.php
lib/tests/filelib_test.php
lib/tests/filetypes_test.php
lib/tests/grouplib_test.php
lib/tests/medialib_test.php
lib/tests/messagelib_test.php
lib/tests/minify_test.php
lib/tests/modinfolib_test.php
lib/tests/moodlelib_test.php
lib/tests/outputcomponents_test.php
lib/tests/outputrequirementslib_test.php
lib/tests/progress_display_test.php
lib/tests/qrcode_test.php
lib/tests/requirejs_test.php
lib/tests/scheduled_task_test.php
lib/tests/session_redis_test.php
lib/tests/setuplib_test.php
lib/tests/tablelib_test.php
media/player/videojs/tests/player_test.php
media/player/youtube/tests/player_test.php
message/output/email/tests/send_email_task_test.php
message/tests/api_test.php
message/tests/externallib_test.php
mod/assign/feedback/comments/tests/privacy_test.php
mod/assign/feedback/editpdf/tests/editpdf_test.php
mod/assign/submission/comments/tests/privacy_test.php
mod/assign/tests/externallib_test.php
mod/assign/tests/locallib_test.php
mod/assign/tests/privacy_test.php
mod/data/tests/lib_test.php
mod/feedback/tests/events_test.php
mod/forum/tests/externallib_test.php
mod/forum/tests/mail_test.php
mod/forum/tests/maildigest_test.php
mod/glossary/tests/external_test.php
mod/quiz/accessrule/seb/tests/quiz_settings_test.php
mod/quiz/accessrule/seb/tests/rule_test.php
mod/quiz/report/overview/tests/report_test.php
mod/quiz/tests/quiz_question_bank_view_test.php
mod/wiki/tests/wikiparser_test.php
mod/workshop/allocation/manual/tests/privacy_provider_test.php
mod/workshop/tests/cron_task_test.php
notes/tests/generator_test.php
question/behaviour/deferredcbm/tests/behaviourtype_test.php
question/engine/tests/helpers.php
question/format/aiken/tests/aikenformat_test.php
question/format/multianswer/tests/multianswerformat_test.php
question/format/xml/tests/qformat_xml_import_export_test.php
question/tests/bank_view_test.php
question/tests/question_bank_column_test.php
question/type/essay/tests/walkthrough_test.php
search/engine/solr/tests/engine_test.php
search/tests/external_test.php
search/tests/manager_test.php
user/tests/externallib_test.php
user/tests/userroleseditable_test.php

index 7162955..71b4b94 100644 (file)
@@ -165,7 +165,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
 
@@ -219,7 +219,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
 
@@ -264,7 +264,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
 
@@ -295,7 +295,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
         // Check contexts.
@@ -324,7 +324,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
         // Check contexts.
@@ -368,7 +368,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
         // Check contexts.
@@ -399,7 +399,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
         // Check contexts.
@@ -428,7 +428,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
         // Check contexts.
@@ -532,7 +532,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
         // Check contexts.
@@ -611,7 +611,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
         // Check contexts.
@@ -646,7 +646,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
 
@@ -662,7 +662,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
 
@@ -678,7 +678,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
 
@@ -693,7 +693,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
             $this->assertCount(count($paths), $suites[$themename]['paths']);
 
             foreach ($paths as $key => $feature) {
-                $this->assertContains($feature, $suites[$themename]['paths'][$key]);
+                $this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
             }
         }
     }
index 7bf94cc..4cb3450 100644 (file)
@@ -997,8 +997,8 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
         $this->assertEquals($subject, $message->subject);
         $this->assertEquals('tool_dataprivacy', $message->component);
         $this->assertEquals('contactdataprotectionofficer', $message->eventtype);
-        $this->assertContains(fullname($dpo), $message->fullmessage);
-        $this->assertContains(fullname($user1), $message->fullmessage);
+        $this->assertStringContainsString(fullname($dpo), $message->fullmessage);
+        $this->assertStringContainsString(fullname($user1), $message->fullmessage);
     }
 
     /**
index e671fa7..cfbaac3 100644 (file)
@@ -142,7 +142,7 @@ class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
         $this->assertEquals($strs->statusrejected, $data[1]->status);
         $this->assertEquals($strs->creationmanual, $data[1]->creationmethod);
         $this->assertEmpty($data[1]->comments);
-        $this->assertContains('Nope', $data[1]->dpocomment);
+        $this->assertStringContainsString('Nope', $data[1]->dpocomment);
         $this->assertNotEmpty($data[1]->timecreated);
     }
 
@@ -184,4 +184,4 @@ class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
 
         $this->assertEquals(6, $preferences[helper::PREF_REQUEST_PERPAGE]->value);
     }
-}
\ No newline at end of file
+}
index e3599c6..fb60090 100644 (file)
@@ -155,7 +155,7 @@ class httpsreplace_test extends \advanced_testcase {
         $finder->upgrade_http_links();
 
         $summary = $DB->get_field('course', 'summary', ['id' => $course->id]);
-        $this->assertContains($expectedcontent, $summary);
+        $this->assertStringContainsString($expectedcontent, $summary);
     }
 
     /**
@@ -253,10 +253,10 @@ class httpsreplace_test extends \advanced_testcase {
         $this->assertCount(0, $results);
 
         $summary = $DB->get_field('course', 'summary', ['id' => $course->id]);
-        $this->assertContains('http://intentionally.unavailable/page.php', $summary);
-        $this->assertContains('http://other.unavailable/page.php', $summary);
-        $this->assertNotContains('https://intentionally.unavailable', $summary);
-        $this->assertNotContains('https://other.unavailable', $summary);
+        $this->assertStringContainsString('http://intentionally.unavailable/page.php', $summary);
+        $this->assertStringContainsString('http://other.unavailable/page.php', $summary);
+        $this->assertStringNotContainsString('https://intentionally.unavailable', $summary);
+        $this->assertStringNotContainsString('https://other.unavailable', $summary);
     }
 
     /**
@@ -281,7 +281,7 @@ class httpsreplace_test extends \advanced_testcase {
 
         $finder->upgrade_http_links();
         $summary = $DB->get_field('course', 'summary', ['id' => $course->id]);
-        $this->assertContains($CFG->wwwroot, $summary);
+        $this->assertStringContainsString($CFG->wwwroot, $summary);
     }
 
     /**
@@ -298,10 +298,10 @@ class httpsreplace_test extends \advanced_testcase {
         $output = ob_get_contents();
         ob_end_clean();
         $this->assertTrue($results);
-        $this->assertNotContains('https://somesite', $output);
+        $this->assertStringNotContainsString('https://somesite', $output);
         $testconf = get_config('core', 'test_upgrade_http_links');
-        $this->assertContains('http://somesite', $testconf);
-        $this->assertNotContains('https://somesite', $testconf);
+        $this->assertStringContainsString('http://somesite', $testconf);
+        $this->assertStringNotContainsString('https://somesite', $testconf);
     }
 
     /**
@@ -331,8 +331,8 @@ class httpsreplace_test extends \advanced_testcase {
         $finder->upgrade_http_links();
 
         $summary = $DB->get_field('course', 'summary', ['id' => $course->id]);
-        $this->assertContains('https://secure.example.com', $summary);
-        $this->assertNotContains('http://example.com', $summary);
+        $this->assertStringContainsString('https://secure.example.com', $summary);
+        $this->assertStringNotContainsString('http://example.com', $summary);
         $this->assertEquals('<script src="https://secure.example.com/test.js">' .
             '<img src="https://secure.example.com/someimage.png">', $summary);
     }
@@ -401,7 +401,7 @@ class httpsreplace_test extends \advanced_testcase {
         $finder->upgrade_http_links();
 
         $record = $DB->get_record('reserved_words_temp', []);
-        $this->assertContains($expectedcontent, $record->where);
+        $this->assertStringContainsString($expectedcontent, $record->where);
 
         $dbman->drop_table($table);
     }
index 18721a2..e9fc4f4 100644 (file)
@@ -132,7 +132,7 @@ class tool_mobile_api_testcase extends externallib_advanced_testcase {
         $email = reset($emails);
 
         // Check we got the promotion text.
-        $this->assertContains($mobileappdownloadpage, quoted_printable_decode($email->body));
+        $this->assertStringContainsString($mobileappdownloadpage, quoted_printable_decode($email->body));
         $sink->clear();
 
         // Disable mobile so we don't get mobile promotions.
@@ -142,7 +142,7 @@ class tool_mobile_api_testcase extends externallib_advanced_testcase {
         $this->assertCount(1, $emails);
         $email = reset($emails);
         // Check we don't get the promotion text.
-        $this->assertNotContains($mobileappdownloadpage, quoted_printable_decode($email->body));
+        $this->assertStringNotContainsString($mobileappdownloadpage, quoted_printable_decode($email->body));
         $sink->clear();
 
         // Enable mobile again and set current user mobile token so we don't get mobile promotions.
@@ -158,7 +158,7 @@ class tool_mobile_api_testcase extends externallib_advanced_testcase {
         $this->assertCount(1, $emails);
         $email = reset($emails);
         // Check we don't get the promotion text.
-        $this->assertNotContains($mobileappdownloadpage, quoted_printable_decode($email->body));
+        $this->assertStringNotContainsString($mobileappdownloadpage, quoted_printable_decode($email->body));
         $sink->clear();
         $sink->close();
     }
index 0909aaf..00d75a6 100644 (file)
@@ -158,11 +158,11 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
 
         $this->assertEquals('Google', $identityproviders[0]['name']);
         $this->assertEquals($irecord->image, $identityproviders[0]['iconurl']);
-        $this->assertContains($CFG->wwwroot, $identityproviders[0]['url']);
+        $this->assertStringContainsString($CFG->wwwroot, $identityproviders[0]['url']);
 
         $this->assertEquals('CAS', $identityproviders[1]['name']);
         $this->assertEmpty($identityproviders[1]['iconurl']);
-        $this->assertContains($CFG->wwwroot, $identityproviders[1]['url']);
+        $this->assertStringContainsString($CFG->wwwroot, $identityproviders[1]['url']);
 
         $this->assertEquals($expected, $result);
 
@@ -171,7 +171,7 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
         set_config('auth_logo', $newurl, 'auth_cas');
         $result = external::get_public_config();
         $result = external_api::clean_returnvalue(external::get_public_config_returns(), $result);
-        $this->assertContains($newurl, $result['identityproviders'][1]['iconurl']);
+        $this->assertStringContainsString($newurl, $result['identityproviders'][1]['iconurl']);
     }
 
     /**
index 35a90b4..d6b50a4 100644 (file)
@@ -500,18 +500,18 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
 
         $this->assertRegExp('~<h2>.*' . preg_quote($event->get_url()->out(), '~') . '.*</h2>~', $msg->fullmessagehtml);
         $this->assertRegExp('~<li>.*' . preg_quote($modurl->out(), '~') . '.*</li>~', $msg->fullmessagehtml);
-        $this->assertContains('<li><strong>'.$rule->get_name($context).'</strong></li>', $msg->fullmessagehtml);
-        $this->assertContains('<li>'.$rule->get_description($context).'</li>', $msg->fullmessagehtml);
-        $this->assertContains('<li>'.$rule->get_event_name().'</li>', $msg->fullmessagehtml);
+        $this->assertStringContainsString('<li><strong>'.$rule->get_name($context).'</strong></li>', $msg->fullmessagehtml);
+        $this->assertStringContainsString('<li>'.$rule->get_description($context).'</li>', $msg->fullmessagehtml);
+        $this->assertStringContainsString('<li>'.$rule->get_event_name().'</li>', $msg->fullmessagehtml);
 
         $this->assertEquals(FORMAT_PLAIN, $msg->fullmessageformat);
-        $this->assertNotContains('<h2>', $msg->fullmessage);
-        $this->assertNotContains('##', $msg->fullmessage);
-        $this->assertContains(strtoupper($event->get_url()->out()), $msg->fullmessage);
-        $this->assertContains('* '.$modurl->out(), $msg->fullmessage);
-        $this->assertContains('* '.strtoupper($rule->get_name($context)), $msg->fullmessage);
-        $this->assertContains('* '.$rule->get_description($context), $msg->fullmessage);
-        $this->assertContains('* '.$rule->get_event_name(), $msg->fullmessage);
+        $this->assertStringNotContainsString('<h2>', $msg->fullmessage);
+        $this->assertStringNotContainsString('##', $msg->fullmessage);
+        $this->assertStringContainsString(strtoupper($event->get_url()->out()), $msg->fullmessage);
+        $this->assertStringContainsString('* '.$modurl->out(), $msg->fullmessage);
+        $this->assertStringContainsString('* '.strtoupper($rule->get_name($context)), $msg->fullmessage);
+        $this->assertStringContainsString('* '.$rule->get_description($context), $msg->fullmessage);
+        $this->assertStringContainsString('* '.$rule->get_event_name(), $msg->fullmessage);
     }
 
     /**
index 5dc0ff0..aba224e 100644 (file)
@@ -75,7 +75,7 @@ class tool_templatelibrary_external_testcase extends externallib_advanced_testca
         $template = external::load_canonical_template('core', 'notification_error');
 
         // Only the base template should contain the docs.
-        $this->assertContains('@template core/notification_error', $template);
+        $this->assertStringContainsString('@template core/notification_error', $template);
 
         // Restore the original theme.
         $CFG->theme = $originaltheme;
index 8843f60..400e7ea 100644 (file)
@@ -1230,7 +1230,7 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
         $data = \core_course\customfield\course_handler::create()->export_instance_data_object($course->id);
         $this->assertEquals('Wednesday, 1 April 2020, 4:00 PM', $data->mydatefield, '', 0.0, 10, false, true);
         $this->assertEquals($dataupload['customfield_mytextfield'], $data->mytextfield);
-        $this->assertContains($dataupload['customfield_mytextareafield'], $data->mytextareafield);
+        $this->assertStringContainsString($dataupload['customfield_mytextareafield'], $data->mytextareafield);
     }
 
     /**
index 8e552e1..4c580c0 100644 (file)
@@ -183,6 +183,6 @@ class tool_usertours_privacy_provider_testcase extends \core_privacy\tests\provi
         $this->assertCount(1, (array) $prefs);
 
         // The preference should be related to the first tour.
-        $this->assertContains($tour1->get_name(), reset($prefs)->description);
+        $this->assertStringContainsString($tour1->get_name(), reset($prefs)->description);
     }
 }
index fb600c8..b877e72 100644 (file)
@@ -60,10 +60,10 @@ class dataset_manager_testcase extends advanced_testcase {
         $f1 = $dataset1->store($dataset1data);
 
         $f1contents = $f1->get_content();
-        $this->assertContains('yeah', $f1contents);
-        $this->assertContains('var1', $f1contents);
-        $this->assertContains('value1', $f1contents);
-        $this->assertContains('header1', $f1contents);
+        $this->assertStringContainsString('yeah', $f1contents);
+        $this->assertStringContainsString('var1', $f1contents);
+        $this->assertStringContainsString('value1', $f1contents);
+        $this->assertStringContainsString('header1', $f1contents);
     }
 
     /**
@@ -86,11 +86,11 @@ class dataset_manager_testcase extends advanced_testcase {
             \core_analytics\dataset_manager::LABELLED_FILEAREA);
 
         $mergedfilecontents = $merged->get_content();
-        $this->assertContains('yeah', $mergedfilecontents);
-        $this->assertContains('no', $mergedfilecontents);
-        $this->assertContains('var1', $mergedfilecontents);
-        $this->assertContains('value1', $mergedfilecontents);
-        $this->assertContains('header1', $mergedfilecontents);
+        $this->assertStringContainsString('yeah', $mergedfilecontents);
+        $this->assertStringContainsString('no', $mergedfilecontents);
+        $this->assertStringContainsString('var1', $mergedfilecontents);
+        $this->assertStringContainsString('value1', $mergedfilecontents);
+        $this->assertStringContainsString('header1', $mergedfilecontents);
     }
 
     /**
index ab5b2ff..71bbce2 100644 (file)
@@ -46,8 +46,8 @@ class auth_oauth2_auth_testcase extends advanced_testcase {
                 ['subject', 'message'],
                 array_keys($info),
                 '', 0.0, 10, true);
-        $this->assertContains(
+        $this->assertStringContainsString(
                 'your password cannot be reset because you are using your account on another site to log in',
                 $info['message']);
     }
-}
\ No newline at end of file
+}
index 02d8476..4526198 100644 (file)
@@ -116,7 +116,7 @@ class availability_completion_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->cm', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->cm', $e->getMessage());
         }
 
         // Invalid $cm.
@@ -125,7 +125,7 @@ class availability_completion_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->cm', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->cm', $e->getMessage());
         }
 
         // Missing $e.
@@ -134,7 +134,7 @@ class availability_completion_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->e', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->e', $e->getMessage());
         }
 
         // Invalid $e.
@@ -143,7 +143,7 @@ class availability_completion_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->e', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->e', $e->getMessage());
         }
 
         // Successful construct & display with all different expected values.
index ae2b2a7..d6186ae 100644 (file)
@@ -96,7 +96,7 @@ class availability_date_condition_testcase extends advanced_testcase {
             $date = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->d', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->d', $e->getMessage());
         }
 
         // Invalid ->d.
@@ -105,7 +105,7 @@ class availability_date_condition_testcase extends advanced_testcase {
             $date = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->d', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->d', $e->getMessage());
         }
 
         // Missing ->t.
@@ -114,7 +114,7 @@ class availability_date_condition_testcase extends advanced_testcase {
             $date = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->t', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->t', $e->getMessage());
         }
 
         // Invalid ->t.
@@ -123,7 +123,7 @@ class availability_date_condition_testcase extends advanced_testcase {
             $date = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->t', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->t', $e->getMessage());
         }
 
         // Valid conditions of both types.
index 8f2eb02..f0968c1 100644 (file)
@@ -149,7 +149,7 @@ class availability_grade_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->id', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->id', $e->getMessage());
         }
 
         // Invalid id (not int).
@@ -158,7 +158,7 @@ class availability_grade_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->id', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->id', $e->getMessage());
         }
 
         // Invalid min (not number).
@@ -168,7 +168,7 @@ class availability_grade_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->min', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->min', $e->getMessage());
         }
 
         // Invalid max (not number).
@@ -178,7 +178,7 @@ class availability_grade_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->max', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->max', $e->getMessage());
         }
 
         // All valid.
index 2f7d618..10f9a83 100644 (file)
@@ -122,7 +122,7 @@ class availability_group_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid ->id', $e->getMessage());
+            $this->assertStringContainsString('Invalid ->id', $e->getMessage());
         }
 
         // Valid (with id).
index 5f5f776..3a03610 100644 (file)
@@ -132,7 +132,7 @@ class availability_grouping_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing ->id / ->activity', $e->getMessage());
+            $this->assertStringContainsString('Missing ->id / ->activity', $e->getMessage());
         }
 
         // Invalid id (not int).
@@ -141,7 +141,7 @@ class availability_grouping_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid ->id', $e->getMessage());
+            $this->assertStringContainsString('Invalid ->id', $e->getMessage());
         }
 
         // Invalid activity option (not bool).
@@ -151,7 +151,7 @@ class availability_grouping_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid ->activity', $e->getMessage());
+            $this->assertStringContainsString('Invalid ->activity', $e->getMessage());
         }
 
         // Invalid activity option (false).
@@ -160,7 +160,7 @@ class availability_grouping_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid ->activity', $e->getMessage());
+            $this->assertStringContainsString('Invalid ->activity', $e->getMessage());
         }
 
         // Valid with id.
index c6dc98d..6ec42c5 100644 (file)
@@ -105,7 +105,7 @@ class availability_profile_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->op', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->op', $e->getMessage());
         }
 
         // Invalid op.
@@ -114,7 +114,7 @@ class availability_profile_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->op', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->op', $e->getMessage());
         }
 
         // Missing value.
@@ -123,7 +123,7 @@ class availability_profile_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->v', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->v', $e->getMessage());
         }
 
         // Invalid value (not string).
@@ -132,7 +132,7 @@ class availability_profile_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing or invalid ->v', $e->getMessage());
+            $this->assertStringContainsString('Missing or invalid ->v', $e->getMessage());
         }
 
         // Unexpected value.
@@ -141,7 +141,7 @@ class availability_profile_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Unexpected ->v', $e->getMessage());
+            $this->assertStringContainsString('Unexpected ->v', $e->getMessage());
         }
 
         // Missing field.
@@ -151,7 +151,7 @@ class availability_profile_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Missing ->sf or ->cf', $e->getMessage());
+            $this->assertStringContainsString('Missing ->sf or ->cf', $e->getMessage());
         }
 
         // Invalid field (not string).
@@ -160,7 +160,7 @@ class availability_profile_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid ->sf', $e->getMessage());
+            $this->assertStringContainsString('Invalid ->sf', $e->getMessage());
         }
 
         // Both fields.
@@ -170,7 +170,7 @@ class availability_profile_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Both ->sf and ->cf', $e->getMessage());
+            $this->assertStringContainsString('Both ->sf and ->cf', $e->getMessage());
         }
 
         // Invalid ->cf field (not string).
@@ -180,7 +180,7 @@ class availability_profile_condition_testcase extends advanced_testcase {
             $cond = new condition($structure);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid ->cf', $e->getMessage());
+            $this->assertStringContainsString('Invalid ->cf', $e->getMessage());
         }
 
         // Valid examples (checks values are correctly included).
index befd3ff..2510ac9 100644 (file)
@@ -91,7 +91,7 @@ class info_testcase extends advanced_testcase {
         $debugging = $this->getDebuggingMessages();
         $this->resetDebugging();
         $this->assertEquals(1, count($debugging));
-        $this->assertContains('Invalid availability', $debugging[0]->message);
+        $this->assertStringContainsString('Invalid availability', $debugging[0]->message);
 
         // Check empty one.
         $info = new info_module($cm4);
@@ -145,7 +145,7 @@ class info_testcase extends advanced_testcase {
         $debugging = $this->getDebuggingMessages();
         $this->resetDebugging();
         $this->assertEquals(1, count($debugging));
-        $this->assertContains('Invalid availability', $debugging[0]->message);
+        $this->assertStringContainsString('Invalid availability', $debugging[0]->message);
 
         // Check empty one.
         $info = new info_section($sections[4]);
index 2760c58..0bf6290 100644 (file)
@@ -49,83 +49,83 @@ class tree_testcase extends \advanced_testcase {
             new tree('frog');
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('not object', $e->getMessage());
+            $this->assertStringContainsString('not object', $e->getMessage());
         }
         try {
             new tree((object)array());
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('missing ->op', $e->getMessage());
+            $this->assertStringContainsString('missing ->op', $e->getMessage());
         }
         try {
             new tree((object)array('op' => '*'));
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('unknown ->op', $e->getMessage());
+            $this->assertStringContainsString('unknown ->op', $e->getMessage());
         }
         try {
             new tree((object)array('op' => '|'));
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('missing ->show', $e->getMessage());
+            $this->assertStringContainsString('missing ->show', $e->getMessage());
         }
         try {
             new tree((object)array('op' => '|', 'show' => 0));
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('->show not bool', $e->getMessage());
+            $this->assertStringContainsString('->show not bool', $e->getMessage());
         }
         try {
             new tree((object)array('op' => '&'));
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('missing ->showc', $e->getMessage());
+            $this->assertStringContainsString('missing ->showc', $e->getMessage());
         }
         try {
             new tree((object)array('op' => '&', 'showc' => 0));
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('->showc not array', $e->getMessage());
+            $this->assertStringContainsString('->showc not array', $e->getMessage());
         }
         try {
             new tree((object)array('op' => '&', 'showc' => array(0)));
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('->showc value not bool', $e->getMessage());
+            $this->assertStringContainsString('->showc value not bool', $e->getMessage());
         }
         try {
             new tree((object)array('op' => '|', 'show' => true));
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('missing ->c', $e->getMessage());
+            $this->assertStringContainsString('missing ->c', $e->getMessage());
         }
         try {
             new tree((object)array('op' => '|', 'show' => true,
                     'c' => 'side'));
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('->c not array', $e->getMessage());
+            $this->assertStringContainsString('->c not array', $e->getMessage());
         }
         try {
             new tree((object)array('op' => '|', 'show' => true,
                     'c' => array(3)));
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('child not object', $e->getMessage());
+            $this->assertStringContainsString('child not object', $e->getMessage());
         }
         try {
             new tree((object)array('op' => '|', 'show' => true,
                     'c' => array((object)array('type' => 'doesnotexist'))));
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Unknown condition type: doesnotexist', $e->getMessage());
+            $this->assertStringContainsString('Unknown condition type: doesnotexist', $e->getMessage());
         }
         try {
             new tree((object)array('op' => '|', 'show' => true,
                     'c' => array((object)array())));
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('missing ->op', $e->getMessage());
+            $this->assertStringContainsString('missing ->op', $e->getMessage());
         }
         try {
             new tree((object)array('op' => '&',
@@ -134,7 +134,7 @@ class tree_testcase extends \advanced_testcase {
                     ));
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('->c, ->showc mismatch', $e->getMessage());
+            $this->assertStringContainsString('->c, ->showc mismatch', $e->getMessage());
         }
     }
 
index 3b27084..48fe54d 100644 (file)
@@ -64,8 +64,8 @@ class block_rss_client_cron_testcase extends advanced_testcase {
         error_reporting($errorlevel);
 
         $cronoutput = ob_get_clean();
-        $this->assertContains('skipping until ' . userdate($record->skipuntil), $cronoutput);
-        $this->assertContains('0 feeds refreshed (took ', $cronoutput);
+        $this->assertStringContainsString('skipping until ' . userdate($record->skipuntil), $cronoutput);
+        $this->assertStringContainsString('0 feeds refreshed (took ', $cronoutput);
     }
 
     /**
index e6105c8..f48fa7f 100644 (file)
@@ -327,7 +327,7 @@ class core_blog_events_testcase extends advanced_testcase {
                 'relateduserid' => 2,
                 'other' => array('associateid' => 2 , 'blogid' => 3, 'subject' => 'blog subject')));
         } catch (coding_exception $e) {
-            $this->assertContains('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage());
+            $this->assertStringContainsString('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage());
         }
         try {
             \core\event\blog_association_created::create(array(
@@ -336,7 +336,7 @@ class core_blog_events_testcase extends advanced_testcase {
                 'relateduserid' => 2,
                 'other' => array('associateid' => 2 , 'blogid' => 3, 'associatetype' => 'random', 'subject' => 'blog subject')));
         } catch (coding_exception $e) {
-            $this->assertContains('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage());
+            $this->assertStringContainsString('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage());
         }
         // Make sure associateid validations work.
         try {
@@ -346,7 +346,7 @@ class core_blog_events_testcase extends advanced_testcase {
                 'relateduserid' => 2,
                 'other' => array('blogid' => 3, 'associatetype' => 'course', 'subject' => 'blog subject')));
         } catch (coding_exception $e) {
-            $this->assertContains('The \'associateid\' value must be set in other.', $e->getMessage());
+            $this->assertStringContainsString('The \'associateid\' value must be set in other.', $e->getMessage());
         }
         // Make sure blogid validations work.
         try {
@@ -356,7 +356,7 @@ class core_blog_events_testcase extends advanced_testcase {
                 'relateduserid' => 2,
                 'other' => array('associateid' => 3, 'associatetype' => 'course', 'subject' => 'blog subject')));
         } catch (coding_exception $e) {
-            $this->assertContains('The \'blogid\' value must be set in other.', $e->getMessage());
+            $this->assertStringContainsString('The \'blogid\' value must be set in other.', $e->getMessage());
         }
         // Make sure blogid validations work.
         try {
@@ -366,7 +366,7 @@ class core_blog_events_testcase extends advanced_testcase {
                 'relateduserid' => 2,
                 'other' => array('blogid' => 3, 'associateid' => 3, 'associatetype' => 'course')));
         } catch (coding_exception $e) {
-            $this->assertContains('The \'subject\' value must be set in other.', $e->getMessage());
+            $this->assertStringContainsString('The \'subject\' value must be set in other.', $e->getMessage());
         }
     }
 
index 7d9c52f..f252b4c 100644 (file)
@@ -1729,7 +1729,7 @@ class core_cache_testcase extends advanced_testcase {
             cache_helper::purge_by_definition('phpunit', 'purge2');
             $this->fail('Should not be able to purge a definition required identifiers without providing them.');
         } catch (coding_exception $ex) {
-            $this->assertContains('Identifier required for cache has not been provided', $ex->getMessage());
+            $this->assertStringContainsString('Identifier required for cache has not been provided', $ex->getMessage());
         }
     }
 
index fdb852c..1d79f13 100644 (file)
@@ -126,7 +126,7 @@ class core_calendar_events_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_created to be triggered without
                     other['repeatid']");
         } catch (coding_exception $e) {
-            $this->assertContains('The \'repeatid\' value must be set in other.', $e->getMessage());
+            $this->assertStringContainsString('The \'repeatid\' value must be set in other.', $e->getMessage());
         }
 
         // Test not setting other['name'].
@@ -142,7 +142,7 @@ class core_calendar_events_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_created to be triggered without
                     other['name']");
         } catch (coding_exception $e) {
-            $this->assertContains('The \'name\' value must be set in other.', $e->getMessage());
+            $this->assertStringContainsString('The \'name\' value must be set in other.', $e->getMessage());
         }
 
         // Test not setting other['timestart'].
@@ -158,7 +158,7 @@ class core_calendar_events_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
                     other['timestart']");
         } catch (coding_exception $e) {
-            $this->assertContains('The \'timestart\' value must be set in other.', $e->getMessage());
+            $this->assertStringContainsString('The \'timestart\' value must be set in other.', $e->getMessage());
         }
     }
 
@@ -274,7 +274,7 @@ class core_calendar_events_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_updated to be triggered without
                     other['repeatid']");
         } catch (coding_exception $e) {
-            $this->assertContains('The \'repeatid\' value must be set in other.', $e->getMessage());
+            $this->assertStringContainsString('The \'repeatid\' value must be set in other.', $e->getMessage());
         }
 
         // Test not setting other['name'].
@@ -290,7 +290,7 @@ class core_calendar_events_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_updated to be triggered without
                     other['name']");
         } catch (coding_exception $e) {
-            $this->assertContains('The \'name\' value must be set in other.', $e->getMessage());
+            $this->assertStringContainsString('The \'name\' value must be set in other.', $e->getMessage());
         }
 
         // Test not setting other['timestart'].
@@ -306,7 +306,7 @@ class core_calendar_events_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
                     other['timestart']");
         } catch (coding_exception $e) {
-            $this->assertContains('The \'timestart\' value must be set in other.', $e->getMessage());
+            $this->assertStringContainsString('The \'timestart\' value must be set in other.', $e->getMessage());
         }
     }
 
@@ -386,7 +386,7 @@ class core_calendar_events_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
                     other['repeatid']");
         } catch (coding_exception $e) {
-            $this->assertContains('The \'repeatid\' value must be set in other.', $e->getMessage());
+            $this->assertStringContainsString('The \'repeatid\' value must be set in other.', $e->getMessage());
         }
 
         // Test not setting other['name'].
@@ -402,7 +402,7 @@ class core_calendar_events_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
                     other['name']");
         } catch (coding_exception $e) {
-            $this->assertContains('The \'name\' value must be set in other.', $e->getMessage());
+            $this->assertStringContainsString('The \'name\' value must be set in other.', $e->getMessage());
         }
 
         // Test not setting other['timestart'].
@@ -418,7 +418,7 @@ class core_calendar_events_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\calendar_event_deleted to be triggered without
                     other['timestart']");
         } catch (coding_exception $e) {
-            $this->assertContains('The \'timestart\' value must be set in other.', $e->getMessage());
+            $this->assertStringContainsString('The \'timestart\' value must be set in other.', $e->getMessage());
         }
     }
 
index 53e2a3a..bc33c03 100644 (file)
@@ -374,7 +374,7 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
         foreach ($events['events'] as $event) {
             if (!empty($event['description'])) {
                 $withdescription++;
-                $this->assertContains($expectedurl, $event['description']);
+                $this->assertStringContainsString($expectedurl, $event['description']);
             }
         }
         $this->assertEquals(2, $withdescription);
index a2ec653..101a58d 100644 (file)
@@ -309,7 +309,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
             core_cohort_external::update_cohorts(array($cohort1));
             $this->fail('Expecting invalid_parameter_exception exception, none occured');
         } catch (invalid_parameter_exception $e1) {
-            $this->assertContains('Invalid external api parameter: the value is "THIS IS NOT AN ID"', $e1->debuginfo);
+            $this->assertStringContainsString('Invalid external api parameter: the value is "THIS IS NOT AN ID"', $e1->debuginfo);
         }
 
         $cohort1['id'] = 9.999; // Also not a valid id of a cohort.
@@ -317,7 +317,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
             core_cohort_external::update_cohorts(array($cohort1));
             $this->fail('Expecting invalid_parameter_exception exception, none occured');
         } catch (invalid_parameter_exception $e2) {
-            $this->assertContains('Invalid external api parameter: the value is "9.999"', $e2->debuginfo);
+            $this->assertStringContainsString('Invalid external api parameter: the value is "9.999"', $e2->debuginfo);
         }
     }
 
index 384be5f..38e81f9 100644 (file)
@@ -1408,7 +1408,7 @@ class core_competency_event_testcase extends advanced_testcase {
             \core\event\competency_evidence_created::create($eventdata)->trigger();
             $this->fail('Coding exception should have been thrown: ' . $errormsg);
         } catch (coding_exception $e) {
-            $this->assertContains($errormsg, $e->getMessage());
+            $this->assertStringContainsString($errormsg, $e->getMessage());
         }
         $eventdata['relateduserid'] = 1;
 
@@ -1418,7 +1418,7 @@ class core_competency_event_testcase extends advanced_testcase {
             \core\event\competency_evidence_created::create($eventdata)->trigger();
             $this->fail('Coding exception should have been thrown: ' . $errormsg);
         } catch (coding_exception $e) {
-            $this->assertContains($errormsg, $e->getMessage());
+            $this->assertStringContainsString($errormsg, $e->getMessage());
         }
         $eventdata['other']['usercompetencyid'] = 1;
 
@@ -1428,7 +1428,7 @@ class core_competency_event_testcase extends advanced_testcase {
             \core\event\competency_evidence_created::create($eventdata)->trigger();
             $this->fail('Coding exception should have been thrown: ' . $errormsg);
         } catch (coding_exception $e) {
-            $this->assertContains($errormsg, $e->getMessage());
+            $this->assertStringContainsString($errormsg, $e->getMessage());
         }
         $eventdata['other']['competencyid'] = 1;
 
@@ -1438,7 +1438,7 @@ class core_competency_event_testcase extends advanced_testcase {
             \core\event\competency_evidence_created::create($eventdata)->trigger();
             $this->fail('Coding exception should have been thrown: ' . $errormsg);
         } catch (coding_exception $e) {
-            $this->assertContains($errormsg, $e->getMessage());
+            $this->assertStringContainsString($errormsg, $e->getMessage());
         }
         $eventdata['other']['action'] = 1;
 
@@ -1448,7 +1448,7 @@ class core_competency_event_testcase extends advanced_testcase {
             \core\event\competency_evidence_created::create($eventdata)->trigger();
             $this->fail('Coding exception should have been thrown: ' . $errormsg);
         } catch (coding_exception $e) {
-            $this->assertContains($errormsg, $e->getMessage());
+            $this->assertStringContainsString($errormsg, $e->getMessage());
         }
         $eventdata['other']['recommend'] = 1;
 
index e2e8af7..20363fa 100644 (file)
@@ -1758,7 +1758,7 @@ class core_competency_external_testcase extends externallib_advanced_testcase {
         $resultduplicated = external::list_competencies_in_template($duplicatedtemplate->id);
 
         $this->assertEquals(count($result), count($resultduplicated));
-        $this->assertContains($template->shortname, $duplicatedtemplate->shortname);
+        $this->assertStringContainsString($template->shortname, $duplicatedtemplate->shortname);
         $this->assertEquals($duplicatedtemplate->description, $template->description);
         $this->assertEquals($duplicatedtemplate->descriptionformat, $template->descriptionformat);
         $this->assertEquals($duplicatedtemplate->visible, $template->visible);
index 0575f35..eba2334 100644 (file)
@@ -99,7 +99,7 @@ class core_competency_lib_testcase extends advanced_testcase {
         // Test customdata.
         $customdata = json_decode($message->customdata);
         $this->assertObjectHasAttribute('notificationiconurl', $customdata);
-        $this->assertContains('tokenpluginfile.php', $customdata->notificationiconurl);
+        $this->assertStringContainsString('tokenpluginfile.php', $customdata->notificationiconurl);
         $userpicture = new \user_picture($u1);
         $userpicture->size = 1; // Use f1 size.
         $userpicture->includetoken = $u2->id;
index c806134..63c5d08 100644 (file)
@@ -135,7 +135,7 @@ class contenttype_h5p_contenttype_plugin_testcase extends advanced_testcase {
         // Because we don't know specific H5P content type yet.
         $defaulticon = $contenttype->get_icon($filltheblanks);
         $this->assertEquals($defaulticon, $contenttype->get_icon($findethewords));
-        $this->assertContains('h5p', $defaulticon);
+        $this->assertStringContainsString('h5p', $defaulticon);
 
         // Deploy one of the contents though the player to create the H5P DB entries and know specific content type.
         $h5pplayer = new \core_h5p\player($findethewords->get_file_url(), new \stdClass(), true);
@@ -145,7 +145,7 @@ class contenttype_h5p_contenttype_plugin_testcase extends advanced_testcase {
         // Once the H5P has been deployed, we know the specific H5P content type, so the icon returned is not default one.
         $findicon = $contenttype->get_icon($findethewords);
         $this->assertNotEquals($defaulticon, $findicon);
-        $this->assertContains('find', $findicon, '', true);
+        $this->assertStringContainsStringIgnoringCase('find', $findicon);
     }
 
     /**
@@ -171,7 +171,7 @@ class contenttype_h5p_contenttype_plugin_testcase extends advanced_testcase {
         // Check before deploying the URL is returned OK.
         $url1 = $contenttype->get_download_url($filltheblanks);
         $this->assertNotEmpty($url1);
-        $this->assertContains($filename, $url1);
+        $this->assertStringContainsString($filename, $url1);
 
         // Deploy the contents though the player to create the H5P DB entries and know specific content type.
         $h5pplayer = new \core_h5p\player($filltheblanks->get_file_url(), new \stdClass(), true);
index 9ca729a..cdba73e 100644 (file)
@@ -244,7 +244,7 @@ class core_contentbank_testcase extends advanced_testcase {
         $this->assertCount($expectedresult, $contents);
         if (!empty($contents) && !empty($search)) {
             foreach ($contents as $content) {
-                $this->assertContains($search, $content->get_name());
+                $this->assertStringContainsString($search, $content->get_name());
             }
         }
     }
index 1995357..09c0a39 100644 (file)
@@ -112,7 +112,7 @@ class core_contenttype_contenttype_testcase extends \advanced_testcase {
         $record->name = 'New content';
         $content = $testable->create_content($record);
         $icon = $testable->get_icon($content);
-        $this->assertContains('archive', $icon);
+        $this->assertStringContainsString('archive', $icon);
     }
 
     /**
@@ -649,7 +649,7 @@ class core_contenttype_contenttype_testcase extends \advanced_testcase {
         $contenttype = new contenttype($systemcontext);
         $url = $contenttype->get_download_url($content);
         $this->assertNotEmpty($url);
-        $this->assertContains($filename, $url);
+        $this->assertStringContainsString($filename, $url);
 
         // Check the URL is empty when the content hasn't any file.
         $record = new stdClass();
index 3ba00bd..f555d56 100644 (file)
@@ -2480,7 +2480,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_created to be triggered without
                     other['instanceid']");
         } catch (coding_exception $e) {
-            $this->assertContains("The 'instanceid' value must be set in other.", $e->getMessage());
+            $this->assertStringContainsString("The 'instanceid' value must be set in other.", $e->getMessage());
         }
 
         // Test not setting modulename.
@@ -2497,7 +2497,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_created to be triggered without
                     other['modulename']");
         } catch (coding_exception $e) {
-            $this->assertContains("The 'modulename' value must be set in other.", $e->getMessage());
+            $this->assertStringContainsString("The 'modulename' value must be set in other.", $e->getMessage());
         }
 
         // Test not setting name.
@@ -2515,7 +2515,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_created to be triggered without
                     other['name']");
         } catch (coding_exception $e) {
-            $this->assertContains("The 'name' value must be set in other.", $e->getMessage());
+            $this->assertStringContainsString("The 'name' value must be set in other.", $e->getMessage());
         }
 
     }
@@ -2640,7 +2640,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_updated to be triggered without
                     other['instanceid']");
         } catch (coding_exception $e) {
-            $this->assertContains("The 'instanceid' value must be set in other.", $e->getMessage());
+            $this->assertStringContainsString("The 'instanceid' value must be set in other.", $e->getMessage());
         }
 
         // Test not setting modulename.
@@ -2657,7 +2657,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_updated to be triggered without
                     other['modulename']");
         } catch (coding_exception $e) {
-            $this->assertContains("The 'modulename' value must be set in other.", $e->getMessage());
+            $this->assertStringContainsString("The 'modulename' value must be set in other.", $e->getMessage());
         }
 
         // Test not setting name.
@@ -2675,7 +2675,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_updated to be triggered without
                     other['name']");
         } catch (coding_exception $e) {
-            $this->assertContains("The 'name' value must be set in other.", $e->getMessage());
+            $this->assertStringContainsString("The 'name' value must be set in other.", $e->getMessage());
         }
 
     }
@@ -2743,7 +2743,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_deleted to be triggered without
                     other['instanceid']");
         } catch (coding_exception $e) {
-            $this->assertContains("The 'instanceid' value must be set in other.", $e->getMessage());
+            $this->assertStringContainsString("The 'instanceid' value must be set in other.", $e->getMessage());
         }
 
         // Test not setting modulename.
@@ -2760,7 +2760,7 @@ class core_course_courselib_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\core\\event\\course_module_deleted to be triggered without
                     other['modulename']");
         } catch (coding_exception $e) {
-            $this->assertContains("The 'modulename' value must be set in other.", $e->getMessage());
+            $this->assertStringContainsString("The 'modulename' value must be set in other.", $e->getMessage());
         }
     }
 
index e061802..f6bc7b6 100644 (file)
@@ -622,7 +622,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
 
         $warning = reset($result['warnings']);
         $this->assertEquals('errorinvalidparam', $warning['warningcode']);
-        $this->assertContains($expectedemptyfield, $warning['message']);
+        $this->assertStringContainsString($expectedemptyfield, $warning['message']);
     }
 
     /**
@@ -1111,7 +1111,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
                 $this->assertEquals($formattedtext, $module['description']);
                 $this->assertEquals($forumcm->instance, $module['instance']);
                 $this->assertEquals(context_module::instance($forumcm->id)->id, $module['contextid']);
-                $this->assertContains('1 unread post', $module['afterlink']);
+                $this->assertStringContainsString('1 unread post', $module['afterlink']);
                 $this->assertFalse($module['noviewlink']);
                 $this->assertNotEmpty($module['description']);  // Module showdescription is on.
                 $testexecuted = $testexecuted + 2;
@@ -1126,7 +1126,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
                 $this->assertNotEmpty($module['description']);  // Label always prints the description.
                 $testexecuted = $testexecuted + 1;
             } else if ($module['id'] == $datacm->id and $module['modname'] == 'data') {
-                $this->assertContains('customcompletionrules', $module['customdata']);
+                $this->assertStringContainsString('customcompletionrules', $module['customdata']);
                 $this->assertFalse($module['noviewlink']);
                 $this->assertArrayNotHasKey('description', $module);
                 $testexecuted = $testexecuted + 1;
@@ -1134,7 +1134,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
         }
         foreach ($sections[2]['modules'] as $module) {
             if ($module['id'] == $urlcm->id and $module['modname'] == 'url') {
-                $this->assertContains('width=100,height=100', $module['onclick']);
+                $this->assertStringContainsString('width=100,height=100', $module['onclick']);
                 $testexecuted = $testexecuted + 1;
             }
         }
@@ -1155,8 +1155,8 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
         $this->assertEquals(2, $sections[2]['section']);
         $this->assertEquals(3, $sections[3]['section']);
         $this->assertEquals(4, $sections[4]['section']);
-        $this->assertContains('<iframe', $sections[2]['summary']);
-        $this->assertContains('</iframe>', $sections[2]['summary']);
+        $this->assertStringContainsString('<iframe', $sections[2]['summary']);
+        $this->assertStringContainsString('</iframe>', $sections[2]['summary']);
         $this->assertNotEmpty($sections[2]['modules'][0]['availabilityinfo']);
         try {
             $sections = core_course_external::get_course_contents($course->id,
index 75a79cd..3e6c992 100644 (file)
@@ -351,7 +351,7 @@ class enrol_lti_helper_testcase extends advanced_testcase {
         $tool1 = $generator->create_lti_tool($data);
 
         $description = \enrol_lti\helper::get_description($tool1);
-        $this->assertContains('Test course 1 Lorem ipsum dolor sit amet', $description);
+        $this->assertStringContainsString('Test course 1 Lorem ipsum dolor sit amet', $description);
 
         $module1 = $generator->create_module('assign', array(
                 'course' => $course1->id
@@ -360,7 +360,7 @@ class enrol_lti_helper_testcase extends advanced_testcase {
         $data->cmid = $module1->cmid;
         $tool2 = $generator->create_lti_tool($data);
         $description = \enrol_lti\helper::get_description($tool2);
-        $this->assertContains('Test assign 1', $description);
+        $this->assertStringContainsString('Test assign 1', $description);
     }
 
     /**
@@ -377,7 +377,7 @@ class enrol_lti_helper_testcase extends advanced_testcase {
         $icon = \enrol_lti\helper::get_icon($tool);
         $icon = $icon->out();
         // Only local icons are supported by the LTI framework.
-        $this->assertContains($CFG->wwwroot, $icon);
+        $this->assertStringContainsString($CFG->wwwroot, $icon);
 
     }
 
@@ -532,8 +532,8 @@ class enrol_lti_helper_testcase extends advanced_testcase {
         $tool1 = $this->getDataGenerator()->create_lti_tool($data);
 
         $cartridge = \enrol_lti\helper::create_cartridge($tool1->id);
-        $this->assertContains('<blti:title>Test LTI</blti:title>', $cartridge);
-        $this->assertContains("<blti:icon>$CFG->wwwroot/theme/image.php/_s/boost/theme/1/favicon</blti:icon>", $cartridge);
-        $this->assertContains("<blti:launch_url>$CFG->wwwroot/enrol/lti/tool.php?id=$tool1->id</blti:launch_url>", $cartridge);
+        $this->assertStringContainsString('<blti:title>Test LTI</blti:title>', $cartridge);
+        $this->assertStringContainsString("<blti:icon>$CFG->wwwroot/theme/image.php/_s/boost/theme/1/favicon</blti:icon>", $cartridge);
+        $this->assertStringContainsString("<blti:launch_url>$CFG->wwwroot/enrol/lti/tool.php?id=$tool1->id</blti:launch_url>", $cartridge);
     }
 }
index e39ec7a..6448d91 100644 (file)
@@ -136,7 +136,7 @@ class sync_members_testcase extends advanced_testcase {
         $this->task->execute();
         $output = ob_get_clean();
         $message = 'Skipping task - ' . get_string('pluginnotenabled', 'auth', get_string('pluginname', 'auth_lti'));
-        $this->assertContains($message, $output);
+        $this->assertStringContainsString($message, $output);
     }
 
     /**
@@ -150,7 +150,7 @@ class sync_members_testcase extends advanced_testcase {
         $this->task->execute();
         $output = ob_get_clean();
         $message = 'Skipping task - ' . get_string('enrolisdisabled', 'enrol_lti');
-        $this->assertContains($message, $output);
+        $this->assertStringContainsString($message, $output);
     }
 
     /**
@@ -168,10 +168,10 @@ class sync_members_testcase extends advanced_testcase {
         $output = ob_get_clean();
 
         $membersyncmessage = "Completed - Synced members for tool '{$this->tool->id}' in the course '{$this->tool->courseid}'";
-        $this->assertContains($membersyncmessage, $output);
+        $this->assertStringContainsString($membersyncmessage, $output);
 
         $imagesyncmessage = "Completed - Synced 0 profile images.";
-        $this->assertContains($imagesyncmessage, $output);
+        $this->assertStringContainsString($imagesyncmessage, $output);
     }
 
     /**
index c05987b..5055926 100644 (file)
@@ -148,7 +148,7 @@ class tool_provider_testcase extends advanced_testcase {
         $tp->message = $message;
         $tp->onError();
         $errormessage = get_string('failedrequest', 'enrol_lti', ['reason' => $message]);
-        $this->assertContains($errormessage, $tp->get_error_output());
+        $this->assertStringContainsString($errormessage, $tp->get_error_output());
     }
 
     /**
@@ -256,8 +256,8 @@ class tool_provider_testcase extends advanced_testcase {
         $successmessage = get_string('successfulregistration', 'enrol_lti');
 
         // Check output contents. Confirm that it has the success message and return URL.
-        $this->assertContains($successmessage, $output);
-        $this->assertContains($tp->returnUrl, $output);
+        $this->assertStringContainsString($successmessage, $output);
+        $this->assertStringContainsString($tp->returnUrl, $output);
 
         // The OK flag will be true on successful registration.
         $this->assertTrue($tp->ok);
@@ -285,7 +285,7 @@ class tool_provider_testcase extends advanced_testcase {
         @$tp->onLaunch();
         $output = ob_get_clean();
 
-        $this->assertContains(get_string('frameembeddingnotenabled', 'enrol_lti'), $output);
+        $this->assertStringContainsString(get_string('frameembeddingnotenabled', 'enrol_lti'), $output);
     }
 
     /**
@@ -373,7 +373,7 @@ class tool_provider_testcase extends advanced_testcase {
 
         $this->assertTrue($tp->ok);
         $this->assertEquals(get_string('success'), $tp->message);
-        $this->assertContains(get_string('frameembeddingnotenabled', 'enrol_lti'), $output);
+        $this->assertStringContainsString(get_string('frameembeddingnotenabled', 'enrol_lti'), $output);
     }
 
     /**
index 9233c40..662fa83 100644 (file)
@@ -431,49 +431,49 @@ class enrol_manual_lib_testcase extends advanced_testcase {
         // First individual notifications from course1.
         $this->assertEquals($user3->id, $messages[0]->useridto);
         $this->assertEquals($user8->id, $messages[0]->useridfrom);
-        $this->assertContains('xcourse1', $messages[0]->fullmessagehtml);
+        $this->assertStringContainsString('xcourse1', $messages[0]->fullmessagehtml);
 
         $this->assertEquals($user4->id, $messages[1]->useridto);
         $this->assertEquals($user8->id, $messages[1]->useridfrom);
-        $this->assertContains('xcourse1', $messages[1]->fullmessagehtml);
+        $this->assertStringContainsString('xcourse1', $messages[1]->fullmessagehtml);
 
         // Then summary for course1.
         $this->assertEquals($user8->id, $messages[2]->useridto);
         $this->assertEquals($admin->id, $messages[2]->useridfrom);
-        $this->assertContains('xcourse1', $messages[2]->fullmessagehtml);
-        $this->assertNotContains('xuser1', $messages[2]->fullmessagehtml);
-        $this->assertNotContains('xuser2', $messages[2]->fullmessagehtml);
-        $this->assertContains('xuser3', $messages[2]->fullmessagehtml);
-        $this->assertContains('xuser4', $messages[2]->fullmessagehtml);
-        $this->assertContains('xuser5', $messages[2]->fullmessagehtml);
-        $this->assertNotContains('xuser6', $messages[2]->fullmessagehtml);
+        $this->assertStringContainsString('xcourse1', $messages[2]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser1', $messages[2]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser2', $messages[2]->fullmessagehtml);
+        $this->assertStringContainsString('xuser3', $messages[2]->fullmessagehtml);
+        $this->assertStringContainsString('xuser4', $messages[2]->fullmessagehtml);
+        $this->assertStringContainsString('xuser5', $messages[2]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser6', $messages[2]->fullmessagehtml);
 
         // First individual notifications from course2.
         $this->assertEquals($user3->id, $messages[3]->useridto);
         $this->assertEquals($admin->id, $messages[3]->useridfrom);
-        $this->assertContains('xcourse2', $messages[3]->fullmessagehtml);
+        $this->assertStringContainsString('xcourse2', $messages[3]->fullmessagehtml);
 
         // Then summary for course2.
         $this->assertEquals($admin->id, $messages[4]->useridto);
         $this->assertEquals($admin->id, $messages[4]->useridfrom);
-        $this->assertContains('xcourse2', $messages[4]->fullmessagehtml);
-        $this->assertNotContains('xuser1', $messages[4]->fullmessagehtml);
-        $this->assertNotContains('xuser2', $messages[4]->fullmessagehtml);
-        $this->assertContains('xuser3', $messages[4]->fullmessagehtml);
-        $this->assertNotContains('xuser4', $messages[4]->fullmessagehtml);
-        $this->assertNotContains('xuser5', $messages[4]->fullmessagehtml);
-        $this->assertNotContains('xuser6', $messages[4]->fullmessagehtml);
+        $this->assertStringContainsString('xcourse2', $messages[4]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser1', $messages[4]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser2', $messages[4]->fullmessagehtml);
+        $this->assertStringContainsString('xuser3', $messages[4]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser4', $messages[4]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser5', $messages[4]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser6', $messages[4]->fullmessagehtml);
 
         // Only summary in course3.
         $this->assertEquals($user1->id, $messages[5]->useridto);
         $this->assertEquals($admin->id, $messages[5]->useridfrom);
-        $this->assertContains('xcourse3', $messages[5]->fullmessagehtml);
-        $this->assertNotContains('xuser1', $messages[5]->fullmessagehtml);
-        $this->assertNotContains('xuser2', $messages[5]->fullmessagehtml);
-        $this->assertContains('xuser3', $messages[5]->fullmessagehtml);
-        $this->assertNotContains('xuser4', $messages[5]->fullmessagehtml);
-        $this->assertNotContains('xuser5', $messages[5]->fullmessagehtml);
-        $this->assertNotContains('xuser6', $messages[5]->fullmessagehtml);
+        $this->assertStringContainsString('xcourse3', $messages[5]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser1', $messages[5]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser2', $messages[5]->fullmessagehtml);
+        $this->assertStringContainsString('xuser3', $messages[5]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser4', $messages[5]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser5', $messages[5]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser6', $messages[5]->fullmessagehtml);
 
 
         // Make sure that notifications are not repeated.
index e939eaf..b6b0e21 100644 (file)
@@ -394,49 +394,49 @@ class enrol_self_testcase extends advanced_testcase {
         // First individual notifications from course1.
         $this->assertEquals($user3->id, $messages[0]->useridto);
         $this->assertEquals($user8->id, $messages[0]->useridfrom);
-        $this->assertContains('xcourse1', $messages[0]->fullmessagehtml);
+        $this->assertStringContainsString('xcourse1', $messages[0]->fullmessagehtml);
 
         $this->assertEquals($user4->id, $messages[1]->useridto);
         $this->assertEquals($user8->id, $messages[1]->useridfrom);
-        $this->assertContains('xcourse1', $messages[1]->fullmessagehtml);
+        $this->assertStringContainsString('xcourse1', $messages[1]->fullmessagehtml);
 
         // Then summary for course1.
         $this->assertEquals($user8->id, $messages[2]->useridto);
         $this->assertEquals($admin->id, $messages[2]->useridfrom);
-        $this->assertContains('xcourse1', $messages[2]->fullmessagehtml);
-        $this->assertNotContains('xuser1', $messages[2]->fullmessagehtml);
-        $this->assertNotContains('xuser2', $messages[2]->fullmessagehtml);
-        $this->assertContains('xuser3', $messages[2]->fullmessagehtml);
-        $this->assertContains('xuser4', $messages[2]->fullmessagehtml);
-        $this->assertContains('xuser5', $messages[2]->fullmessagehtml);
-        $this->assertNotContains('xuser6', $messages[2]->fullmessagehtml);
+        $this->assertStringContainsString('xcourse1', $messages[2]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser1', $messages[2]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser2', $messages[2]->fullmessagehtml);
+        $this->assertStringContainsString('xuser3', $messages[2]->fullmessagehtml);
+        $this->assertStringContainsString('xuser4', $messages[2]->fullmessagehtml);
+        $this->assertStringContainsString('xuser5', $messages[2]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser6', $messages[2]->fullmessagehtml);
 
         // First individual notifications from course2.
         $this->assertEquals($user3->id, $messages[3]->useridto);
         $this->assertEquals($admin->id, $messages[3]->useridfrom);
-        $this->assertContains('xcourse2', $messages[3]->fullmessagehtml);
+        $this->assertStringContainsString('xcourse2', $messages[3]->fullmessagehtml);
 
         // Then summary for course2.
         $this->assertEquals($admin->id, $messages[4]->useridto);
         $this->assertEquals($admin->id, $messages[4]->useridfrom);
-        $this->assertContains('xcourse2', $messages[4]->fullmessagehtml);
-        $this->assertNotContains('xuser1', $messages[4]->fullmessagehtml);
-        $this->assertNotContains('xuser2', $messages[4]->fullmessagehtml);
-        $this->assertContains('xuser3', $messages[4]->fullmessagehtml);
-        $this->assertNotContains('xuser4', $messages[4]->fullmessagehtml);
-        $this->assertNotContains('xuser5', $messages[4]->fullmessagehtml);
-        $this->assertNotContains('xuser6', $messages[4]->fullmessagehtml);
+        $this->assertStringContainsString('xcourse2', $messages[4]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser1', $messages[4]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser2', $messages[4]->fullmessagehtml);
+        $this->assertStringContainsString('xuser3', $messages[4]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser4', $messages[4]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser5', $messages[4]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser6', $messages[4]->fullmessagehtml);
 
         // Only summary in course3.
         $this->assertEquals($user1->id, $messages[5]->useridto);
         $this->assertEquals($admin->id, $messages[5]->useridfrom);
-        $this->assertContains('xcourse3', $messages[5]->fullmessagehtml);
-        $this->assertNotContains('xuser1', $messages[5]->fullmessagehtml);
-        $this->assertNotContains('xuser2', $messages[5]->fullmessagehtml);
-        $this->assertContains('xuser3', $messages[5]->fullmessagehtml);
-        $this->assertNotContains('xuser4', $messages[5]->fullmessagehtml);
-        $this->assertNotContains('xuser5', $messages[5]->fullmessagehtml);
-        $this->assertNotContains('xuser6', $messages[5]->fullmessagehtml);
+        $this->assertStringContainsString('xcourse3', $messages[5]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser1', $messages[5]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser2', $messages[5]->fullmessagehtml);
+        $this->assertStringContainsString('xuser3', $messages[5]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser4', $messages[5]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser5', $messages[5]->fullmessagehtml);
+        $this->assertStringNotContainsString('xuser6', $messages[5]->fullmessagehtml);
 
 
         // Make sure that notifications are not repeated.
@@ -616,7 +616,7 @@ class enrol_self_testcase extends advanced_testcase {
         $selfplugin->enrol_user($instance1, $user2->id, $editingteacherrole->id);
 
         $this->setUser($guest);
-        $this->assertContains(get_string('noguestaccess', 'enrol'),
+        $this->assertStringContainsString(get_string('noguestaccess', 'enrol'),
                 $selfplugin->can_self_enrol($instance1, true));
 
         $this->setUser($user1);
index 3229085..eb781ae 100644 (file)
@@ -129,7 +129,7 @@ class filter_mediaplugin_testcase extends advanced_testcase {
         $precededlongurl = '<a href="http://moodle.org/testfile/test.mp3">test.mp3</a>'. $longurl;
         $filter = $filterplugin->filter($precededlongurl);
         $this->assertEquals(1, substr_count($filter, '</audio>'));
-        $this->assertContains($longurl, $filter);
+        $this->assertStringContainsString($longurl, $filter);
 
         // Testing for cases where: to be filtered content has 6+ text afterwards.
         $filter = $filterplugin->filter($paddedurl);
index 8e4ac6a..5fce120 100644 (file)
@@ -199,6 +199,6 @@ class core_grade_import_lib_test extends advanced_testcase {
         $output = ob_get_contents();
         ob_end_clean();
         $this->assertTrue($status);
-        $this->assertContains("++ Grade import success ++", $output);
+        $this->assertStringContainsString("++ Grade import success ++", $output);
     }
 }
index d617f48..431d129 100644 (file)
@@ -274,13 +274,13 @@ class core_grade_report_graderlib_testcase extends advanced_testcase {
 
         // The second row should contain 2 cells - one for the graded quiz and course total.
         $this->assertCount(2, $result[1]->cells);
-        $this->assertContains('NormalQuiz', $result[1]->cells[0]->text);
-        $this->assertContains('Course total', $result[1]->cells[1]->text);
+        $this->assertStringContainsString('NormalQuiz', $result[1]->cells[0]->text);
+        $this->assertStringContainsString('Course total', $result[1]->cells[1]->text);
 
         // User row should contain grade values '-'.
         $this->assertCount(2, $result[2]->cells);
-        $this->assertContains('>-<', $result[2]->cells[0]->text);
-        $this->assertContains('>-<', $result[2]->cells[1]->text);
+        $this->assertStringContainsString('>-<', $result[2]->cells[0]->text);
+        $this->assertStringContainsString('>-<', $result[2]->cells[1]->text);
 
         // Supposing the user cannot view hidden grades, this shouldn't make any difference (due
         // to a bug, it previously did).
index 8199d35..d014f60 100644 (file)
@@ -596,7 +596,7 @@ class h5p_file_storage_testcase extends \advanced_testcase {
             $h5plib->minorversion
         );
         if ($expected) {
-            $this->assertContains(file_storage::ICON_FILENAME, $iconurl);
+            $this->assertStringContainsString(file_storage::ICON_FILENAME, $iconurl);
         } else {
             $this->assertFalse($iconurl);
         }
index a58f61a..8e20542 100644 (file)
@@ -197,7 +197,7 @@ class helper_testcase extends \advanced_testcase {
         $h5p = $DB->get_record('h5p', ['id' => $h5pid]);
         $this->assertEquals($lib->id, $h5p->mainlibraryid);
         $this->assertEquals(helper::get_display_options($factory->get_core(), $config), $h5p->displayoptions);
-        $this->assertContains('Hello world!', $h5p->jsoncontent);
+        $this->assertStringContainsString('Hello world!', $h5p->jsoncontent);
     }
 
     /**
index 53a2ff1..27ea056 100644 (file)
@@ -304,7 +304,7 @@ class pgsql_native_recordset_testcase extends basic_testcase {
             $transaction->rollback(new dml_transaction_exception('rollback please'));
             $this->fail('should not get here');
         } catch (dml_transaction_exception $e) {
-            $this->assertContains('rollback please', $e->getMessage());
+            $this->assertStringContainsString('rollback please', $e->getMessage());
         } finally {
 
             // Rollback should not kill our recordset.
index 56fd859..ca66dd0 100644 (file)
@@ -464,7 +464,7 @@ class core_files_zip_packer_testcase extends advanced_testcase implements file_p
         } catch (Exception $e) {
             // New PHP versions print PHP Warning.
             $this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e);
-            $this->assertContains('ZipArchive::close', $e->getMessage());
+            $this->assertStringContainsString('ZipArchive::close', $e->getMessage());
         }
         // This is crazy, but it shows how some PHP versions do return true.
         try {
index 49c09ee..ac44a5c 100644 (file)
@@ -53,12 +53,12 @@ class core_form_course_testcase extends basic_testcase {
 
         $element = new MoodleQuickForm_course('testel', null, $attributes);
         $html = $element->toHtml();
-        $this->assertContains('data-exclude="1,2"', $html);
-        $this->assertContains('data-requiredcapabilities="moodle/course:update"', $html);
-        $this->assertContains('data-limittoenrolled="0"', $html);
-        $this->assertNotContains('multiple', $html);
-        $this->assertNotContains('data-includefrontpage', $html);
-        $this->assertNotContains('data-onlywithcompletion', $html);
+        $this->assertStringContainsString('data-exclude="1,2"', $html);
+        $this->assertStringContainsString('data-requiredcapabilities="moodle/course:update"', $html);
+        $this->assertStringContainsString('data-limittoenrolled="0"', $html);
+        $this->assertStringNotContainsString('multiple', $html);
+        $this->assertStringNotContainsString('data-includefrontpage', $html);
+        $this->assertStringNotContainsString('data-onlywithcompletion', $html);
 
         // Add more attributes.
         $attributes = [
@@ -69,9 +69,9 @@ class core_form_course_testcase extends basic_testcase {
         ];
         $element = new MoodleQuickForm_course('testel', null, $attributes);
         $html = $element->toHtml();
-        $this->assertContains('multiple', $html);
-        $this->assertContains('data-limittoenrolled="1"', $html);
-        $this->assertContains('data-includefrontpage="' . SITEID . '"', $html);
-        $this->assertContains('data-onlywithcompletion="1"', $html);
+        $this->assertStringContainsString('multiple', $html);
+        $this->assertStringContainsString('data-limittoenrolled="1"', $html);
+        $this->assertStringContainsString('data-includefrontpage="' . SITEID . '"', $html);
+        $this->assertStringContainsString('data-onlywithcompletion="1"', $html);
     }
 }
index cd0c9bc..d5d8db9 100644 (file)
@@ -81,9 +81,9 @@ class core_form_duration_testcase extends basic_testcase {
         $mform->addElement('duration', 'testel', null, ['units' => [MINSECS, 1], 'optional' => false]);
         $html = $mform->toHtml();
         $html = preg_replace('~ +>~', '>', $html); // Clean HTML to avoid spurious errors.
-        $this->assertContains('<option value="60" selected>minutes</option>', $html);
-        $this->assertContains('<option value="1">seconds</option>', $html);
-        $this->assertNotContains('value="3600"', $html);
+        $this->assertStringContainsString('<option value="60" selected>minutes</option>', $html);
+        $this->assertStringContainsString('<option value="1">seconds</option>', $html);
+        $this->assertStringNotContainsString('value="3600"', $html);
     }
 
     /**
index f33e47b..dc74d1d 100644 (file)
@@ -129,9 +129,9 @@ class filetypes_util_testcase extends advanced_testcase {
         $this->assertEquals('.mudrd8mz', $desc[0]->extensions);
 
         $this->assertEquals('Image (JPEG)', $desc[2]->description);
-        $this->assertContains('.jpg', $desc[2]->extensions);
-        $this->assertContains('.jpeg', $desc[2]->extensions);
-        $this->assertContains('.jpe', $desc[2]->extensions);
+        $this->assertStringContainsString('.jpg', $desc[2]->extensions);
+        $this->assertStringContainsString('.jpeg', $desc[2]->extensions);
+        $this->assertStringContainsString('.jpe', $desc[2]->extensions);
 
         // Check that it can describe groups and mimetypes too.
         $desc = $util->describe_file_types('audio text/plain');
@@ -141,12 +141,12 @@ class filetypes_util_testcase extends advanced_testcase {
         $this->assertEquals(2, count($desc));
 
         $this->assertEquals('Audio files', $desc[0]->description);
-        $this->assertContains('.mp3', $desc[0]->extensions);
-        $this->assertContains('.wav', $desc[0]->extensions);
-        $this->assertContains('.ogg', $desc[0]->extensions);
+        $this->assertStringContainsString('.mp3', $desc[0]->extensions);
+        $this->assertStringContainsString('.wav', $desc[0]->extensions);
+        $this->assertStringContainsString('.ogg', $desc[0]->extensions);
 
         $this->assertEquals('Text file', $desc[1]->description);
-        $this->assertContains('.txt', $desc[1]->extensions);
+        $this->assertStringContainsString('.txt', $desc[1]->extensions);
 
         // Empty.
         $desc = $util->describe_file_types('');
index 49e94ca..bdf3dab 100644 (file)
@@ -69,7 +69,7 @@ class core_form_privacy_provider_testcase extends \core_privacy\tests\provider_t
         $this->assertNotEmpty($prefs->filemanager_recentviewmode->value);
         $this->assertNotEmpty($prefs->filemanager_recentviewmode->description);
         $this->assertEquals($val, $prefs->filemanager_recentviewmode->value);
-        $this->assertContains($desc, $prefs->filemanager_recentviewmode->description);
+        $this->assertStringContainsString($desc, $prefs->filemanager_recentviewmode->description);
     }
 
     /**
index f1fd50d..5cef89d 100644 (file)
@@ -235,9 +235,9 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
             self::resetAllData(true);
         } catch (Exception $e) {
             $this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e);
-            $this->assertContains('xx', $e->getMessage());
-            $this->assertContains('admin', $e->getMessage());
-            $this->assertContains('rolesactive', $e->getMessage());
+            $this->assertStringContainsString('xx', $e->getMessage());
+            $this->assertStringContainsString('admin', $e->getMessage());
+            $this->assertStringContainsString('rolesactive', $e->getMessage());
         }
         $this->assertFalse(isset($CFG->xx));
         $this->assertTrue(isset($CFG->admin));
index fb92f8e..d8b0c68 100644 (file)
@@ -97,7 +97,7 @@ class core_antivirus_testcase extends advanced_testcase {
         $this->assertNotEmpty($exception);
         $result = $sink->get_messages();
         $this->assertCount(1, $result);
-        $this->assertContains('fake@example.com', $result[0]->to);
+        $this->assertStringContainsString('fake@example.com', $result[0]->to);
         $sink->close();
     }
 
@@ -174,7 +174,7 @@ class core_antivirus_testcase extends advanced_testcase {
         $this->assertNotEmpty($exception);
         $result = $sink->get_messages();
         $this->assertCount(1, $result);
-        $this->assertContains('fake@example.com', $result[0]->to);
+        $this->assertStringContainsString('fake@example.com', $result[0]->to);
         $sink->close();
     }
 
index 63f14e1..a743a4d 100644 (file)
@@ -457,7 +457,7 @@ class core_authlib_testcase extends advanced_testcase {
         ];
 
         $errors = signup_validate_data($formdata, []);
-        $this->assertContains('This email address is already registered.', $errors['email']);
+        $this->assertStringContainsString('This email address is already registered.', $errors['email']);
 
         // Emails are accent-sensitive though so if we change a -> รก in the u1's email, it should pass.
         // Please note that Moodle does not normally support such emails yet. We test the DB search sensitivity here.
index 7b5ff60..08d93a5 100644 (file)
@@ -1001,7 +1001,7 @@ class core_completionlib_testcase extends advanced_testcase {
         $this->assertEquals($this->user->id, $message->useridto);
         $this->assertEquals('coursecompleted', $message->eventtype);
         $this->assertEquals(get_string('coursecompleted', 'completion'), $message->subject);
-        $this->assertContains($this->course->fullname, $message->fullmessage);
+        $this->assertStringContainsString($this->course->fullname, $message->fullmessage);
     }
 
     /**
index 5feb310..89f7d23 100644 (file)
@@ -150,14 +150,14 @@ class core_media_player_native_testcase extends advanced_testcase {
         $content = $player->embed($urls, $title, 0, 0, []);
 
         // Test sources present.
-        $this->assertContains('<source src="http://example.org/some_filename.mp4" />', $content);
-        $this->assertContains('<source src="http://example.org/some_filename_hires.mp4" />', $content);
+        $this->assertStringContainsString('<source src="http://example.org/some_filename.mp4" />', $content);
+        $this->assertStringContainsString('<source src="http://example.org/some_filename_hires.mp4" />', $content);
 
         // Change sources.
         $newsource = '<source src="http://example.org/new_filename.mp4" />';
         $content = media_test_native_plugin::replace_sources($content, $newsource);
-        $this->assertContains($newsource, $content);
-        $this->assertNotContains('<source src="http://example.org/some_filename.mp4" />', $content);
-        $this->assertNotContains('<source src="http://example.org/some_filename_hires.mp4" />', $content);
+        $this->assertStringContainsString($newsource, $content);
+        $this->assertStringNotContainsString('<source src="http://example.org/some_filename.mp4" />', $content);
+        $this->assertStringNotContainsString('<source src="http://example.org/some_filename_hires.mp4" />', $content);
     }
 }
index 873ec02..dc2a107 100644 (file)
@@ -453,10 +453,10 @@ class core_renderer_template_exploit_testcase extends advanced_testcase {
 
         if ($include) {
             // Confirm that the JS was added to the page.
-            $this->assertContains($js, $page->requires->get_end_code());
+            $this->assertStringContainsString($js, $page->requires->get_end_code());
         } else {
             // Confirm that the JS wasn't added to the page.
-            $this->assertNotContains($js, $page->requires->get_end_code());
+            $this->assertStringNotContainsString($js, $page->requires->get_end_code());
         }
     }
 }
index 28e7bd1..67cb6fa 100644 (file)
@@ -80,7 +80,7 @@ class core_event_course_module_viewed_testcase extends advanced_testcase {
                 'courseid' => 2,
                 'objectid' => 3 ));
         } catch (coding_exception $e) {
-            $this->assertContains("course_module_viewed event must define objectid and object table.", $e->getMessage());
+            $this->assertStringContainsString("course_module_viewed event must define objectid and object table.", $e->getMessage());
         }
 
         try {
@@ -89,7 +89,7 @@ class core_event_course_module_viewed_testcase extends advanced_testcase {
                 'courseid' => 2,
             ));
         } catch (coding_exception $e) {
-            $this->assertContains("course_module_viewed event must define objectid and object table.", $e->getMessage());
+            $this->assertStringContainsString("course_module_viewed event must define objectid and object table.", $e->getMessage());
         }
     }
 }
index 3d91acd..3803427 100644 (file)
@@ -273,7 +273,7 @@ class core_externallib_testcase extends advanced_testcase {
             $cleanedvalue = external_api::clean_returnvalue($returndesc, $testdata);
         } catch (moodle_exception $e) {
             $this->assertInstanceOf('invalid_response_exception', $e);
-            $this->assertContains('of PHP type "NULL"', $e->debuginfo);
+            $this->assertStringContainsString('of PHP type "NULL"', $e->debuginfo);
         }
     }
 
index e3bab6d..7bf0bdc 100644 (file)
@@ -1113,7 +1113,7 @@ EOF;
 
         // Do the rewrite.
         $finaltext = file_rewrite_pluginfile_urls($originaltext, 'pluginfile.php', $syscontext->id, 'user', 'private', 0);
-        $this->assertContains("pluginfile.php", $finaltext);
+        $this->assertStringContainsString("pluginfile.php", $finaltext);
 
         // Now undo.
         $options = array('reverse' => true);
index 5115360..7c2753e 100644 (file)
@@ -64,8 +64,8 @@ class core_filetypes_testcase extends advanced_testcase {
             core_filetypes::add_type('frog', 'application/x-frog', 'document');
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('already exists', $e->getMessage());
-            $this->assertContains('frog', $e->getMessage());
+            $this->assertStringContainsString('already exists', $e->getMessage());
+            $this->assertStringContainsString('frog', $e->getMessage());
         }
 
         // Test bogus extension causes exception.
@@ -73,14 +73,14 @@ class core_filetypes_testcase extends advanced_testcase {
             core_filetypes::add_type('.frog', 'application/x-frog', 'document');
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid extension', $e->getMessage());
-            $this->assertContains('..frog', $e->getMessage());
+            $this->assertStringContainsString('Invalid extension', $e->getMessage());
+            $this->assertStringContainsString('..frog', $e->getMessage());
         }
         try {
             core_filetypes::add_type('', 'application/x-frog', 'document');
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid extension', $e->getMessage());
+            $this->assertStringContainsString('Invalid extension', $e->getMessage());
         }
 
         // Test there is an exception if you add something with defaulticon when
@@ -90,8 +90,8 @@ class core_filetypes_testcase extends advanced_testcase {
                     array(), '', '', true);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('default icon set', $e->getMessage());
-            $this->assertContains('text/plain', $e->getMessage());
+            $this->assertStringContainsString('default icon set', $e->getMessage());
+            $this->assertStringContainsString('text/plain', $e->getMessage());
         }
     }
 
@@ -122,8 +122,8 @@ class core_filetypes_testcase extends advanced_testcase {
             core_filetypes::update_type('doc', 'doc', 'application/x-frog', 'document');
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('not found', $e->getMessage());
-            $this->assertContains('doc', $e->getMessage());
+            $this->assertStringContainsString('not found', $e->getMessage());
+            $this->assertStringContainsString('doc', $e->getMessage());
         }
 
         // Test bogus extension causes exception.
@@ -131,14 +131,14 @@ class core_filetypes_testcase extends advanced_testcase {
             core_filetypes::update_type('docccc', '.frog', 'application/x-frog', 'document');
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid extension', $e->getMessage());
-            $this->assertContains('.frog', $e->getMessage());
+            $this->assertStringContainsString('Invalid extension', $e->getMessage());
+            $this->assertStringContainsString('.frog', $e->getMessage());
         }
         try {
             core_filetypes::update_type('docccc', '', 'application/x-frog', 'document');
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid extension', $e->getMessage());
+            $this->assertStringContainsString('Invalid extension', $e->getMessage());
         }
 
         // Test defaulticon changes.
@@ -147,8 +147,8 @@ class core_filetypes_testcase extends advanced_testcase {
                     array(), '', '', true);
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('default icon set', $e->getMessage());
-            $this->assertContains('text/plain', $e->getMessage());
+            $this->assertStringContainsString('default icon set', $e->getMessage());
+            $this->assertStringContainsString('text/plain', $e->getMessage());
         }
     }
 
@@ -169,8 +169,8 @@ class core_filetypes_testcase extends advanced_testcase {
             core_filetypes::delete_type('doc');
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('not found', $e->getMessage());
-            $this->assertContains('doc', $e->getMessage());
+            $this->assertStringContainsString('not found', $e->getMessage());
+            $this->assertStringContainsString('doc', $e->getMessage());
         }
 
         // Try a custom type (slightly different).
@@ -204,8 +204,8 @@ class core_filetypes_testcase extends advanced_testcase {
             core_filetypes::revert_type_to_default('frog');
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('not a default type', $e->getMessage());
-            $this->assertContains('frog', $e->getMessage());
+            $this->assertStringContainsString('not a default type', $e->getMessage());
+            $this->assertStringContainsString('frog', $e->getMessage());
         }
     }
 
index f298447..7f62f08 100644 (file)
@@ -994,29 +994,29 @@ class core_grouplib_testcase extends advanced_testcase {
         // Now user can access one of the group. We can't assert an exact match here because of random ids generated by yui. So do
         // partial match to see if all groups are listed or not.
         $html = groups_allgroups_course_menu($course, 'someurl.php');
-        $this->assertContains(format_string($group1->name), $html);
-        $this->assertNotContains(format_string($group2->name), $html);
+        $this->assertStringContainsString(format_string($group1->name), $html);
+        $this->assertStringNotContainsString(format_string($group2->name), $html);
 
         $this->setAdminUser();
 
         // Now user can access everything.
         $html = groups_allgroups_course_menu($course, 'someurl.php');
-        $this->assertContains(format_string($group1->name), $html);
-        $this->assertContains(format_string($group2->name), $html);
+        $this->assertStringContainsString(format_string($group1->name), $html);
+        $this->assertStringContainsString(format_string($group2->name), $html);
 
         // Make sure separate groups mode, doesn't change anything.
         $course->groupmode = SEPARATEGROUPS;
         update_course($course);
         $html = groups_allgroups_course_menu($course, 'someurl.php');
-        $this->assertContains(format_string($group1->name), $html);
-        $this->assertContains(format_string($group2->name), $html);
+        $this->assertStringContainsString(format_string($group1->name), $html);
+        $this->assertStringContainsString(format_string($group2->name), $html);
 
         // Make sure Visible groups mode, doesn't change anything.
         $course->groupmode = VISIBLEGROUPS;
         update_course($course);
         $html = groups_allgroups_course_menu($course, 'someurl.php');
-        $this->assertContains(format_string($group1->name), $html);
-        $this->assertContains(format_string($group2->name), $html);
+        $this->assertStringContainsString(format_string($group1->name), $html);
+        $this->assertStringContainsString(format_string($group2->name), $html);
 
         // Let us test activegroup changes now.
         $this->setUser($user);
index d92ba7a..bd3ed75 100644 (file)
@@ -215,7 +215,7 @@ class core_medialib_testcase extends advanced_testcase {
         \core\plugininfo\media::set_enabled_plugins('');
         $manager = core_media_manager::instance();
         $t = $manager->embed_url($url);
-        $this->assertContains($link, $t);
+        $this->assertStringContainsString($link, $t);
 
         // Enable media players that can play the same media formats. (ie. test & html5audio for mp3 files, etc.)
         \core\plugininfo\media::set_enabled_plugins('test,html5video,html5audio,swf');
@@ -231,31 +231,31 @@ class core_medialib_testcase extends advanced_testcase {
 
             switch ($format) {
                 case 'mp3':
-                    $this->assertContains($test, $textwithlink);
-                    $this->assertNotContains($html5video, $textwithlink);
-                    $this->assertContains($html5audio, $textwithlink);
-                    $this->assertNotContains($swf, $textwithlink);
-                    $this->assertContains($link, $textwithlink);
-
-                    $this->assertContains($test, $textwithoutlink);
-                    $this->assertNotContains($html5video, $textwithoutlink);
-                    $this->assertContains($html5audio, $textwithoutlink);
-                    $this->assertNotContains($swf, $textwithoutlink);
-                    $this->assertNotContains($link, $textwithoutlink);
+                    $this->assertStringContainsString($test, $textwithlink);
+                    $this->assertStringNotContainsString($html5video, $textwithlink);
+                    $this->assertStringContainsString($html5audio, $textwithlink);
+                    $this->assertStringNotContainsString($swf, $textwithlink);
+                    $this->assertStringContainsString($link, $textwithlink);
+
+                    $this->assertStringContainsString($test, $textwithoutlink);
+                    $this->assertStringNotContainsString($html5video, $textwithoutlink);
+                    $this->assertStringContainsString($html5audio, $textwithoutlink);
+                    $this->assertStringNotContainsString($swf, $textwithoutlink);
+                    $this->assertStringNotContainsString($link, $textwithoutlink);
                     break;
 
                 case 'mp4':
-                    $this->assertContains($test, $textwithlink);
-                    $this->assertContains($html5video, $textwithlink);
-                    $this->assertNotContains($html5audio, $textwithlink);
-                    $this->assertNotContains($swf, $textwithlink);
-                    $this->assertContains($link, $textwithlink);
-
-                    $this->assertContains($test, $textwithoutlink);
-                    $this->assertContains($html5video, $textwithoutlink);
-                    $this->assertNotContains($html5audio, $textwithoutlink);
-                    $this->assertNotContains($swf, $textwithoutlink);
-                    $this->assertNotContains($link, $textwithoutlink);
+                    $this->assertStringContainsString($test, $textwithlink);
+                    $this->assertStringContainsString($html5video, $textwithlink);
+                    $this->assertStringNotContainsString($html5audio, $textwithlink);
+                    $this->assertStringNotContainsString($swf, $textwithlink);
+                    $this->assertStringContainsString($link, $textwithlink);
+
+                    $this->assertStringContainsString($test, $textwithoutlink);
+                    $this->assertStringContainsString($html5video, $textwithoutlink);
+                    $this->assertStringNotContainsString($html5audio, $textwithoutlink);
+                    $this->assertStringNotContainsString($swf, $textwithoutlink);
+                    $this->assertStringNotContainsString($link, $textwithoutlink);
                     break;
 
                 default:
@@ -275,12 +275,12 @@ class core_medialib_testcase extends advanced_testcase {
         // Without any options...
         $url = new moodle_url('http://example.org/test.swf');
         $t = $manager->embed_url($url);
-        $this->assertNotContains('</object>', $t);
+        $this->assertStringNotContainsString('</object>', $t);
 
         // ...and with the 'no it's safe, I checked it' option.
         $url = new moodle_url('http://example.org/test.swf');
         $t = $manager->embed_url($url, '', 0, 0, array(core_media_manager::OPTION_TRUSTED => true));
-        $this->assertContains('</object>', $t);
+        $this->assertStringContainsString('</object>', $t);
     }
 
     /**
@@ -299,7 +299,7 @@ class core_medialib_testcase extends advanced_testcase {
         // Format: mp3.
         $url = new moodle_url('http://example.org/pluginfile.php?file=x/y/z/test.mp3');
         $t = $manager->embed_url($url);
-        $this->assertContains('</audio>', $t);
+        $this->assertStringContainsString('</audio>', $t);
     }
 
     /**
@@ -316,8 +316,8 @@ class core_medialib_testcase extends advanced_testcase {
         // Embed that does match something should still include the link too.
         $url = new moodle_url('http://example.org/test.ogg');
         $t = $manager->embed_url($url, '', 0, 0, $options);
-        $this->assertContains('</audio>', $t);
-        $this->assertContains('mediafallbacklink', $t);
+        $this->assertStringContainsString('</audio>', $t);
+        $this->assertStringContainsString('mediafallbacklink', $t);
 
         // Embed that doesn't match something should be totally blank.
         $url = new moodle_url('http://example.org/test.mp4');
@@ -343,19 +343,19 @@ class core_medialib_testcase extends advanced_testcase {
 
         // HTML5 default size - specifies core width and does not specify height.
         $t = $manager->embed_url($url);
-        $this->assertContains('width="' . $CFG->media_default_width . '"', $t);
-        $this->assertNotContains('height', $t);
+        $this->assertStringContainsString('width="' . $CFG->media_default_width . '"', $t);
+        $this->assertStringNotContainsString('height', $t);
 
         // HTML5 specified size - specifies both.
         $t = $manager->embed_url($url, '', '666', '101');
-        $this->assertContains('width="666"', $t);
-        $this->assertContains('height="101"', $t);
+        $this->assertStringContainsString('width="666"', $t);
+        $this->assertStringContainsString('height="101"', $t);
 
         // HTML5 size specified in url, overrides call.
         $url = new moodle_url('http://example.org/test.mp4?d=123x456');
         $t = $manager->embed_url($url, '', '666', '101');
-        $this->assertContains('width="123"', $t);
-        $this->assertContains('height="456"', $t);
+        $this->assertStringContainsString('width="123"', $t);
+        $this->assertStringContainsString('height="456"', $t);
     }
 
     /**
@@ -372,11 +372,11 @@ class core_medialib_testcase extends advanced_testcase {
 
         // HTML5 default name - use filename.
         $t = $manager->embed_url($url);
-        $this->assertContains('title="test.mp4"', $t);
+        $this->assertStringContainsString('title="test.mp4"', $t);
 
         // HTML5 specified name - check escaping.
         $t = $manager->embed_url($url, 'frog & toad');
-        $this->assertContains('title="frog &amp; toad"', $t);
+        $this->assertStringContainsString('title="frog &amp; toad"', $t);
     }
 
     /**
@@ -439,10 +439,10 @@ class core_medialib_testcase extends advanced_testcase {
         $t = $manager->embed_alternatives($urls);
 
         // HTML5 sources - mp4, but not ogv, flv or webm (not supported in Safari).
-        $this->assertContains('<source src="http://example.org/test.mp4"', $t);
-        $this->assertNotContains('<source src="http://example.org/test.ogv"', $t);
-        $this->assertNotContains('<source src="http://example.org/test.webm"', $t);
-        $this->assertNotContains('<source src="http://example.org/test.flv"', $t);
+        $this->assertStringContainsString('<source src="http://example.org/test.mp4"', $t);
+        $this->assertStringNotContainsString('<source src="http://example.org/test.ogv"', $t);
+        $this->assertStringNotContainsString('<source src="http://example.org/test.webm"', $t);
+        $this->assertStringNotContainsString('<source src="http://example.org/test.flv"', $t);
 
         // FLV is before the video tag (indicating html5 is used as fallback to flv
         // and not vice versa).
@@ -453,10 +453,10 @@ class core_medialib_testcase extends advanced_testcase {
         $t = $manager->embed_alternatives($urls);
 
         // HTML5 sources - mp4, ogv and webm, but not flv.
-        $this->assertContains('<source src="http://example.org/test.mp4"', $t);
-        $this->assertContains('<source src="http://example.org/test.ogv"', $t);
-        $this->assertContains('<source src="http://example.org/test.webm"', $t);
-        $this->assertNotContains('<source src="http://example.org/test.flv"', $t);
+        $this->assertStringContainsString('<source src="http://example.org/test.mp4"', $t);
+        $this->assertStringContainsString('<source src="http://example.org/test.ogv"', $t);
+        $this->assertStringContainsString('<source src="http://example.org/test.webm"', $t);
+        $this->assertStringNotContainsString('<source src="http://example.org/test.flv"', $t);
     }
 
     /**
index bb42547..f891500 100644 (file)
@@ -220,7 +220,7 @@ class core_messagelib_testcase extends advanced_testcase {
         $this->assertEquals($message->smallmessage, $savedmessage->smallmessage);
         $this->assertEquals($message->notification, $savedmessage->notification);
         $this->assertEquals($message->customdata, $savedmessage->customdata);
-        $this->assertContains('datakey', $savedmessage->customdata);
+        $this->assertStringContainsString('datakey', $savedmessage->customdata);
         // Check it was a unserialisable json.
         $customdata = json_decode($savedmessage->customdata);
         $this->assertEquals('data', $customdata->datakey);
index cde85a5..173ff0a 100644 (file)
@@ -87,7 +87,7 @@ function hm()
 
         $js = "function hm{}";
         $result = core_minify::js($js);
-        $this->assertContains($js, $result);
+        $this->assertStringContainsString($js, $result);
     }
 
     public function test_js_files() {
index d50703d..4642652 100644 (file)
@@ -806,7 +806,7 @@ class core_modinfolib_testcase extends advanced_testcase {
             get_course_and_cm_from_cmid($page->cmid, 'pigs can fly');
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid modulename parameter', $e->getMessage());
+            $this->assertStringContainsString('Invalid modulename parameter', $e->getMessage());
         }
 
         // Doesn't exist.
@@ -895,7 +895,7 @@ class core_modinfolib_testcase extends advanced_testcase {
             get_course_and_cm_from_cmid($page->cmid, '1337 h4x0ring');
             $this->fail();
         } catch (coding_exception $e) {
-            $this->assertContains('Invalid modulename parameter', $e->getMessage());
+            $this->assertStringContainsString('Invalid modulename parameter', $e->getMessage());
         }
 
         // Create a second hidden activity.
index d8a6299..68dd0e0 100644 (file)
@@ -3239,8 +3239,8 @@ class core_moodlelib_testcase extends advanced_testcase {
         $emails = $sink->get_messages();
         $this->assertCount(1, $emails);
         $email = reset($emails);
-        $this->assertContains('X-Custom-Header: foo', $email->header);
-        $this->assertContains("X-Fixed-Header: bar", $email->header);
+        $this->assertStringContainsString('X-Custom-Header: foo', $email->header);
+        $this->assertStringContainsString("X-Fixed-Header: bar", $email->header);
         $sink->clear();
     }
 
@@ -3381,13 +3381,13 @@ class core_moodlelib_testcase extends advanced_testcase {
         $this->assertSame($messagetext, trim($result[0]->body));
         $this->assertSame($user1->email, $result[0]->to);
         $this->assertSame($user2->email, $result[0]->from);
-        $this->assertContains('Content-Type: text/plain', $result[0]->header);
+        $this->assertStringContainsString('Content-Type: text/plain', $result[0]->header);
 
         $this->assertSame($subject2, $result[1]->subject);
-        $this->assertContains($messagetext2, quoted_printable_decode($result[1]->body));
+        $this->assertStringContainsString($messagetext2, quoted_printable_decode($result[1]->body));
         $this->assertSame($user2->email, $result[1]->to);
         $this->assertSame($user1->email, $result[1]->from);
-        $this->assertNotContains('Content-Type: text/plain', $result[1]->header);
+        $this->assertStringNotContainsString('Content-Type: text/plain', $result[1]->header);
 
         email_to_user($user1, $user2, $subject, $messagetext);
         $this->assertDebuggingCalled('Unit tests must not send real emails! Use $this->redirectEmails()');
@@ -3426,8 +3426,8 @@ class core_moodlelib_testcase extends advanced_testcase {
         $this->assertSame(1, $sink->count());
         $result = $sink->get_messages();
         $this->assertCount(1, $result);
-        $this->assertContains('error.txt', $result[0]->body);
-        $this->assertContains('Error in attachment.  User attempted to attach a filename with a unsafe name.', $result[0]->body);
+        $this->assertStringContainsString('error.txt', $result[0]->body);
+        $this->assertStringContainsString('Error in attachment.  User attempted to attach a filename with a unsafe name.', $result[0]->body);
         $sink->close();
     }
 
@@ -3483,8 +3483,8 @@ class core_moodlelib_testcase extends advanced_testcase {
 
         // Verify attachment in message body (attachment is in MIME format, but we can detect some Content fields).
         $messagebody = reset($messages)->body;
-        $this->assertContains('Content-Type: text/plain; name="' . $filename . '"', $messagebody);
-        $this->assertContains('Content-Disposition: attachment; filename=' . $filename, $messagebody);
+        $this->assertStringContainsString('Content-Type: text/plain; name="' . $filename . '"', $messagebody);
+        $this->assertStringContainsString('Content-Disposition: attachment; filename=' . $filename, $messagebody);
 
         // Cleanup.
         unlink($filepath);
@@ -3511,8 +3511,8 @@ class core_moodlelib_testcase extends advanced_testcase {
 
         // Verify attachment not in message body (attachment is in MIME format, but we can detect some Content fields).
         $messagebody = reset($messages)->body;
-        $this->assertNotContains('Content-Type: text/plain; name="' . $filename . '"', $messagebody);
-        $this->assertNotContains('Content-Disposition: attachment; filename=' . $filename, $messagebody);
+        $this->assertStringNotContainsString('Content-Type: text/plain; name="' . $filename . '"', $messagebody);
+        $this->assertStringNotContainsString('Content-Disposition: attachment; filename=' . $filename, $messagebody);
     }
 
     /**
@@ -3651,7 +3651,7 @@ class core_moodlelib_testcase extends advanced_testcase {
         $message = array_shift($messages);
         $messagebody = quoted_printable_decode($message->body);
 
-        $this->assertContains($expected, $messagebody);
+        $this->assertStringContainsString($expected, $messagebody);
     }
 
     /**
@@ -3683,7 +3683,7 @@ class core_moodlelib_testcase extends advanced_testcase {
         $messagebody = quoted_printable_decode($message->body);
 
         $sink->close();
-        $this->assertContains($expected, $messagebody);
+        $this->assertStringContainsString($expected, $messagebody);
 
         $CFG->admin = $admin;
     }
@@ -4650,7 +4650,7 @@ class core_moodlelib_testcase extends advanced_testcase {
         $result = $sink->get_messages();
         $sink->close();
 
-        $this->assertContains('passwords cannot be reset on this site', quoted_printable_decode($result[0]->body));
+        $this->assertStringContainsString('passwords cannot be reset on this site', quoted_printable_decode($result[0]->body));
     }
 
     /**
index a5e1515..c46383b 100644 (file)
@@ -469,10 +469,10 @@ EOF;
         $renderer = $page->get_renderer('core');
 
         $reason = 'An icon with no alt text is hidden from screenreaders.';
-        $this->assertContains('aria-hidden="true"', $renderer->pix_icon('t/print', ''), $reason);
+        $this->assertStringContainsString('aria-hidden="true"', $renderer->pix_icon('t/print', ''), $reason);
 
         $reason = 'An icon with alt text is not hidden from screenreaders.';
-        $this->assertNotContains('aria-hidden="true"', $renderer->pix_icon('t/print', 'Print'), $reason);
+        $this->assertStringNotContainsString('aria-hidden="true"', $renderer->pix_icon('t/print', 'Print'), $reason);
 
         // Test another theme with a different icon system.
         set_config('theme', 'classic');
@@ -481,10 +481,10 @@ EOF;
         $renderer = $page->get_renderer('core');
 
         $reason = 'An icon with no alt text is hidden from screenreaders.';
-        $this->assertContains('aria-hidden="true"', $renderer->pix_icon('t/print', ''), $reason);
+        $this->assertStringContainsString('aria-hidden="true"', $renderer->pix_icon('t/print', ''), $reason);
 
         $reason = 'An icon with alt text is not hidden from screenreaders.';
-        $this->assertNotContains('aria-hidden="true"', $renderer->pix_icon('t/print', 'Print'), $reason);
+        $this->assertStringNotContainsString('aria-hidden="true"', $renderer->pix_icon('t/print', 'Print'), $reason);
     }
 
     /**
index d1ac689..b0ca1c3 100644 (file)
@@ -126,12 +126,12 @@ class core_outputrequirementslib_testcase extends advanced_testcase {
         $html = $page->requires->get_end_code();
 
         $modname = 'theme_foobar/lightbox';
-        $this->assertContains("M.util.js_pending('{$modname}'); require(['{$modname}'], function(amd) {M.util.js_complete('{$modname}');});", $html);
+        $this->assertStringContainsString("M.util.js_pending('{$modname}'); require(['{$modname}'], function(amd) {M.util.js_complete('{$modname}');});", $html);
 
         $modname = 'theme_foobar/demo_one';
-        $this->assertContains("M.util.js_pending('{$modname}'); require(['{$modname}'], function(amd) {amd.init(); M.util.js_complete('{$modname}');});", $html);
+        $this->assertStringContainsString("M.util.js_pending('{$modname}'); require(['{$modname}'], function(amd) {amd.init(); M.util.js_complete('{$modname}');});", $html);
 
         $modname = 'theme_foobar/demo_two';
-        $this->assertContains("M.util.js_pending('{$modname}'); require(['{$modname}'], function(amd) {amd.init(\"foo\", \"baz\", [42,\"xyz\"]); M.util.js_complete('{$modname}');});", $html);
+        $this->assertStringContainsString("M.util.js_pending('{$modname}'); require(['{$modname}'], function(amd) {amd.init(\"foo\", \"baz\", [42,\"xyz\"]); M.util.js_complete('{$modname}');});", $html);
     }
 }
index 278c7ea..8c48f4b 100644 (file)
@@ -42,9 +42,9 @@ class progress_display_test extends \advanced_testcase {
         $this->assertEquals(1, $progress->get_direction());
         $this->assertTimeCurrent($progress->get_last_wibble());
         $output = ob_get_clean();
-        $this->assertContains('wibbler', $output);
-        $this->assertContains('wibble state0', $output);
-        $this->assertContains('wibble state1', $output);
+        $this->assertStringContainsString('wibbler', $output);
+        $this->assertStringContainsString('wibble state0', $output);
+        $this->assertStringContainsString('wibble state1', $output);
     }
 
     /**
@@ -70,9 +70,9 @@ class progress_display_test extends \advanced_testcase {
         $this->assertEquals(1, $progress->get_current_state());
         $this->assertEquals(1, $progress->get_direction());
         $output = ob_get_clean();
-        $this->assertContains('wibbler', $output);
-        $this->assertContains('wibble state0', $output);
-        $this->assertContains('wibble state13', $output);
+        $this->assertStringContainsString('wibbler', $output);
+        $this->assertStringContainsString('wibble state0', $output);
+        $this->assertStringContainsString('wibble state13', $output);
 
     }
 
index 95152c4..c91501a 100644 (file)
@@ -48,7 +48,7 @@ class core_qrcode_testcase extends basic_testcase {
         $svgdata = $qrcode->getBarcodeSVGcode(1, 1);
 
         // Just check the SVG was generated.
-        $this->assertContains('<desc>' . $text . '</desc>', $svgdata);
-        $this->assertContains('fill="' . $color . '"', $svgdata);
+        $this->assertStringContainsString('<desc>' . $text . '</desc>', $svgdata);
+        $this->assertStringContainsString('fill="' . $color . '"', $svgdata);
     }
 }
index ef2732a..e53ee78 100644 (file)
@@ -73,7 +73,7 @@ class core_requirejs_testcase extends advanced_testcase {
             if (strpos($component, '_') === false) {
                 $this->assertEquals('core', $component);
             }
-            $this->assertNotContains('.min', $path);
+            $this->assertStringNotContainsString('.min', $path);
         }
 
         // Find all modules - debugging.
@@ -88,7 +88,7 @@ class core_requirejs_testcase extends advanced_testcase {
                 $this->assertEquals('core', $component);
             }
 
-            $this->assertContains('.min', $path);
+            $this->assertStringContainsString('.min', $path);
         }
 
     }
index 54eed4d..56f6915 100644 (file)
@@ -145,7 +145,7 @@ class core_scheduled_task_testcase extends advanced_testcase {
         // Should be displayed in user timezone.
         // I used http://www.timeanddate.com/worldclock/fixedtime.html?msg=Moodle+Test&iso=20160502T01&p1=113
         // setting my location to Kathmandu to verify this time.
-        $this->assertContains('2:15 AM', core_text::strtoupper($userdate));
+        $this->assertStringContainsString('2:15 AM', core_text::strtoupper($userdate));
     }
 
     public function test_reset_scheduled_tasks_for_component_customised(): void {
index 46373d6..028a6b6 100644 (file)
@@ -141,8 +141,8 @@ class core_session_redis_testcase extends advanced_testcase {
             $sessblocked->handler_read('sess1');
             $this->fail('Session lock must fail to be obtained.');
         } catch (\core\session\exception $e) {
-            $this->assertContains("Unable to obtain session lock", $e->getMessage());
-            $this->assertContains('Cannot obtain session lock for sid: sess1', file_get_contents($errorlog));
+            $this->assertStringContainsString("Unable to obtain session lock", $e->getMessage());
+            $this->assertStringContainsString('Cannot obtain session lock for sid: sess1', file_get_contents($errorlog));
         }
 
         $this->assertTrue($sessblocked->handler_close());
@@ -302,7 +302,7 @@ class core_session_redis_testcase extends advanced_testcase {
 
         $expected = 'Failed to connect (try 5 out of 5) to redis at ' . TEST_SESSION_REDIS_HOST . ':111111';
         $this->assertDebuggingCalledCount(5);
-        $this->assertContains($expected, $actual);
+        $this->assertStringContainsString($expected, $actual);
     }
 
     /**
index 469f6ca..7e9f2d2 100644 (file)
@@ -92,8 +92,8 @@ class core_setuplib_testcase extends advanced_testcase {
         $exception     = new moodle_exception('generalexceptionmessage', 'error', '', $fixture, $fixture);
         $exceptioninfo = get_exception_info($exception);
 
-        $this->assertContains($expected, $exceptioninfo->message, 'Exception message does not contain system paths');
-        $this->assertContains($expected, $exceptioninfo->debuginfo, 'Exception debug info does not contain system paths');
+        $this->assertStringContainsString($expected, $exceptioninfo->message, 'Exception message does not contain system paths');
+        $this->assertStringContainsString($expected, $exceptioninfo->debuginfo, 'Exception debug info does not contain system paths');
     }
 
     public function test_localcachedir() {
index 0e41c87..fdb67a7 100644 (file)
@@ -198,7 +198,7 @@ class core_tablelib_testcase extends advanced_testcase {
         );
         $output = ob_get_contents();
         ob_end_clean();
-        $this->assertNotContains(get_string('hide'), $output);
+        $this->assertStringNotContainsString(get_string('hide'), $output);
     }
 
     public function test_has_sort() {
@@ -243,7 +243,7 @@ class core_tablelib_testcase extends advanced_testcase {
         );
         $output = ob_get_contents();
         ob_end_clean();
-        $this->assertNotContains(get_string('sortby'), $output);
+        $this->assertStringNotContainsString(get_string('sortby'), $output);
     }
 
     public function test_has_not_next_pagination() {
@@ -268,7 +268,7 @@ class core_tablelib_testcase extends advanced_testcase {
 
         $output = ob_get_contents();
         ob_end_clean();
-        $this->assertNotContains(get_string('next'), $output);
+        $this->assertStringNotContainsString(get_string('next'), $output);
     }
 
     public function test_1_col() {
@@ -382,7 +382,7 @@ class core_tablelib_testcase extends advanced_testcase {
         $user = $this->getDataGenerator()->create_user();
 
         $table = $this->create_and_setup_table(['fullname'], [], true, false, [], []);
-        $this->assertContains(fullname($user, true), $table->format_row($user)['fullname']);
+        $this->assertStringContainsString(fullname($user, true), $table->format_row($user)['fullname']);
     }
 
     /**
@@ -410,7 +410,7 @@ class core_tablelib_testcase extends advanced_testcase {
         $user = $this->getDataGenerator()->create_user();
 
         $table = $this->create_and_setup_table(['fullname'], [], true, false, [], []);
-        $this->assertContains(fullname($user, false), $table->format_row($user)['fullname']);
+        $this->assertStringContainsString(fullname($user, false), $table->format_row($user)['fullname']);
     }
 
     public function test_get_row_html() {
index c906934..0ed4f26 100644 (file)
@@ -246,8 +246,8 @@ class media_videojs_player_testcase extends advanced_testcase {
      * @param string $t output of core_media_manager::embed_url.
      */
     protected function youtube_plugin_engaged($t) {
-        $this->assertContains('mediaplugin_videojs', $t);
-        $this->assertContains('data-setup-lazy="{&quot;techOrder&quot;: [&quot;youtube&quot;]', $t);
+        $this->assertStringContainsString('mediaplugin_videojs', $t);
+        $this->assertStringContainsString('data-setup-lazy="{&quot;techOrder&quot;: [&quot;youtube&quot;]', $t);
     }
 
     /**
@@ -271,18 +271,18 @@ class media_videojs_player_testcase extends advanced_testcase {
         $url = new moodle_url('https://www.youtube.com/watch?v=dv2f_xfmbD8&index=4&list=PLxcO_MFWQBDcyn9xpbmx601YSDlDcTcr0');
         $t = $manager->embed_url($url);
         $this->youtube_plugin_engaged($t);
-        $this->assertContains('list=PLxcO_MFWQBDcyn9xpbmx601YSDlDcTcr0', $t);
+        $this->assertStringContainsString('list=PLxcO_MFWQBDcyn9xpbmx601YSDlDcTcr0', $t);
 
         // Format: youtube playlist - not supported.
         $url = new moodle_url('http://www.youtube.com/view_play_list?p=PL6E18E2927047B662');
         $t = $manager->embed_url($url);
-        $this->assertNotContains('mediaplugin_videojs', $t);
+        $this->assertStringNotContainsString('mediaplugin_videojs', $t);
         $url = new moodle_url('http://www.youtube.com/playlist?list=PL6E18E2927047B662');
         $t = $manager->embed_url($url);
-        $this->assertNotContains('mediaplugin_videojs', $t);
+        $this->assertStringNotContainsString('mediaplugin_videojs', $t);
         $url = new moodle_url('http://www.youtube.com/p/PL6E18E2927047B662');
         $t = $manager->embed_url($url);
-        $this->assertNotContains('mediaplugin_videojs', $t);
+        $this->assertStringNotContainsString('mediaplugin_videojs', $t);
     }
 
     /**
@@ -317,7 +317,7 @@ class media_videojs_player_testcase extends advanced_testcase {
         $embedcode = core_media_manager::instance()->embed_url(new moodle_url($url));
 
         $this->youtube_plugin_engaged($embedcode);
-        $this->assertContains("&quot;youtube&quot;: {&quot;start&quot;: &quot;{$expectedstart}&quot;}", $embedcode);
+        $this->assertStringContainsString("&quot;youtube&quot;: {&quot;start&quot;: &quot;{$expectedstart}&quot;}", $embedcode);
     }
 
     /**
@@ -326,8 +326,8 @@ class media_videojs_player_testcase extends advanced_testcase {
      * @param string $t output of core_media_manager::embed_url.
      */
     protected function flash_plugin_engaged($t) {
-        $this->assertContains('mediaplugin_videojs', $t);
-        $this->assertContains('data-setup-lazy="{&quot;techOrder&quot;: [&quot;flash&quot;, &quot;html5&quot;]', $t);
+        $this->assertStringContainsString('mediaplugin_videojs', $t);
+        $this->assertStringContainsString('data-setup-lazy="{&quot;techOrder&quot;: [&quot;flash&quot;, &quot;html5&quot;]', $t);
     }
 
     /**
@@ -349,7 +349,7 @@ class media_videojs_player_testcase extends advanced_testcase {
         set_config('useflash', 0, 'media_videojs');
         $url = new moodle_url('http://example.org/some_filename.flv');
         $t = $manager->embed_url($url);
-        $this->assertNotContains('mediaplugin_videojs', $t);
+        $this->assertStringNotContainsString('mediaplugin_videojs', $t);
         $this->assertRegExp('~<a class="mediafallbacklink" href="http://example.org/some_filename.flv">some_filename.flv</a>~', $t);
     }
 
@@ -364,7 +364,7 @@ class media_videojs_player_testcase extends advanced_testcase {
         set_config('rtmp', 0, 'media_videojs');
         $url = new moodle_url('rtmp://example.com/fms&mp4:path/to/file.mp4');
         $t = $manager->embed_url($url);
-        $this->assertNotContains('mediaplugin_videojs', $t);
+        $this->assertStringNotContainsString('mediaplugin_videojs', $t);
         $this->assertRegExp('~<a class="mediafallbacklink" href="rtmp://example.com/fms&mp4:path/to/file.mp4">file.mp4</a>~', $t);
 
         // RTMP enabled, flash disabled.
@@ -372,7 +372,7 @@ class media_videojs_player_testcase extends advanced_testcase {
         set_config('rtmp', 1, 'media_videojs');
         $url = new moodle_url('rtmp://example.com/fms&mp4:path/to/file.mp4');
         $t = $manager->embed_url($url);
-        $this->assertNotContains('mediaplugin_videojs', $t);
+        $this->assertStringNotContainsString('mediaplugin_videojs', $t);
         $this->assertRegExp('~<a class="mediafallbacklink" href="rtmp://example.com/fms&mp4:path/to/file.mp4">file.mp4</a>~', $t);
 
         // RTMP enabled, flash enabled, rtmp/mp4 type expected.
index b5f298e..6df5d3b 100644 (file)
@@ -66,53 +66,53 @@ class media_youtube_testcase extends advanced_testcase {
         // Format: youtube.
         $url = new moodle_url('http://www.youtube.com/watch?v=vyrwMmsufJc');
         $t = $manager->embed_url($url);
-        $this->assertContains('</iframe>', $t);
+        $this->assertStringContainsString('</iframe>', $t);
         $url = new moodle_url('http://www.youtube.com/v/vyrwMmsufJc');
         $t = $manager->embed_url($url);
-        $this->assertContains('</iframe>', $t);
+        $this->assertStringContainsString('</iframe>', $t);
         $url = new moodle_url('http://m.youtube.com/watch?v=vyrwMmsufJc');
         $t = $manager->embed_url($url);
-        $this->assertContains('</iframe>', $t);
+        $this->assertStringContainsString('</iframe>', $t);
 
         // Format: youtube video within playlist.
         $url = new moodle_url('https://www.youtube.com/watch?v=dv2f_xfmbD8&index=4&list=PLxcO_MFWQBDcyn9xpbmx601YSDlDcTcr0');
         $t = $manager->embed_url($url);
-        $this->assertContains('</iframe>', $t);
-        $this->assertContains('list=PLxcO_MFWQBDcyn9xpbmx601YSDlDcTcr0', $t);
+        $this->assertStringContainsString('</iframe>', $t);
+        $this->assertStringContainsString('list=PLxcO_MFWQBDcyn9xpbmx601YSDlDcTcr0', $t);
 
         // Format: youtube video with start time.
         $url = new moodle_url('https://www.youtube.com/watch?v=JNJMF1l3udM&t=1h11s');
         $t = $manager->embed_url($url);
-        $this->assertContains('</iframe>', $t);
-        $this->assertContains('start=3611', $t);
+        $this->assertStringContainsString('</iframe>', $t);
+        $this->assertStringContainsString('start=3611', $t);
 
         // Format: youtube video within playlist with start time.
         $url = new moodle_url('https://www.youtube.com/watch?v=dv2f_xfmbD8&index=4&list=PLxcO_MFWQBDcyn9xpbmx601YSDlDcTcr0&t=1m5s');
         $t = $manager->embed_url($url);
-        $this->assertContains('</iframe>', $t);
-        $this->assertContains('list=PLxcO_MFWQBDcyn9xpbmx601YSDlDcTcr0', $t);
-        $this->assertContains('start=65', $t);
+        $this->assertStringContainsString('</iframe>', $t);
+        $this->assertStringContainsString('list=PLxcO_MFWQBDcyn9xpbmx601YSDlDcTcr0', $t);
+        $this->assertStringContainsString('start=65', $t);
 
         // Format: youtube video with invalid parameter values (injection attempts).
         $url = new moodle_url('https://www.youtube.com/watch?v=dv2f_xfmbD8&index=4&list=PLxcO_">');
         $t = $manager->embed_url($url);
-        $this->assertContains('</iframe>', $t);
-        $this->assertNotContains('list=PLxcO_', $t); // We shouldn't get a list param as input was invalid.
+        $this->assertStringContainsString('</iframe>', $t);
+        $this->assertStringNotContainsString('list=PLxcO_', $t); // We shouldn't get a list param as input was invalid.
         $url = new moodle_url('https://www.youtube.com/watch?v=JNJMF1l3udM&t=">');
         $t = $manager->embed_url($url);
-        $this->assertContains('</iframe>', $t);
-        $this->assertNotContains('start=', $t); // We shouldn't get a start param as input was invalid.
+        $this->assertStringContainsString('</iframe>', $t);
+        $this->assertStringNotContainsString('start=', $t); // We shouldn't get a start param as input was invalid.
 
         // Format: youtube playlist.
         $url = new moodle_url('http://www.youtube.com/view_play_list?p=PL6E18E2927047B662');
         $t = $manager->embed_url($url);
-        $this->assertContains('</iframe>', $t);
+        $this->assertStringContainsString('</iframe>', $t);
         $url = new moodle_url('http://www.youtube.com/playlist?list=PL6E18E2927047B662');
         $t = $manager->embed_url($url);
-        $this->assertContains('</iframe>', $t);
+        $this->assertStringContainsString('</iframe>', $t);
         $url = new moodle_url('http://www.youtube.com/p/PL6E18E2927047B662');
         $t = $manager->embed_url($url);
-        $this->assertContains('</iframe>', $t);
+        $this->assertStringContainsString('</iframe>', $t);
 
     }
 
index b470603..f536622 100644 (file)
@@ -127,8 +127,8 @@ class core_message_send_email_task_testcase extends advanced_testcase {
         $this->assertSame($user2->email, $email->to);
         $this->assertNotEmpty($email->header);
         $emailbody = quoted_printable_decode($email->body);
-        $this->assertContains('Group 1', $emailbody);
-        $this->assertContains('Group 2', $emailbody);
+        $this->assertStringContainsString('Group 1', $emailbody);
+        $this->assertStringContainsString('Group 2', $emailbody);
         // 5 unread messages per conversation, this will be listed twice.
         $this->assertRegExp("/<span\b[^>]*>5<\/span> <span\b[^>]*>Unread message\w+/", $emailbody);
 
index abcacd8..0705be4 100644 (file)
@@ -2270,16 +2270,16 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
         $message4 = $messages[3];
 
         $this->assertEquals($user1->id, $message1->useridfrom);
-        $this->assertContains('Yo!', $message1->text);
+        $this->assertStringContainsString('Yo!', $message1->text);
 
         $this->assertEquals($user2->id, $message2->useridfrom);
-        $this->assertContains('Sup mang?', $message2->text);
+        $this->assertStringContainsString('Sup mang?', $message2->text);
 
         $this->assertEquals($user1->id, $message3->useridfrom);
-        $this->assertContains('Writing PHPUnit tests!', $message3->text);
+        $this->assertStringContainsString('Writing PHPUnit tests!', $message3->text);
 
         $this->assertEquals($user1->id, $message4->useridfrom);
-        $this->assertContains('Word.', $message4->text);
+        $this->assertStringContainsString('Word.', $message4->text);
 
         // Confirm the members data is correct.
         $members = $convmessages['members'];
@@ -2330,19 +2330,19 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
         $message5 = $messages[4];
 
         $this->assertEquals($user1->id, $message1->useridfrom);
-        $this->assertContains('Yo!', $message1->text);
+        $this->assertStringContainsString('Yo!', $message1->text);
 
         $this->assertEquals($user2->id, $message2->useridfrom);
-        $this->assertContains('Sup mang?', $message2->text);
+        $this->assertStringContainsString('Sup mang?', $message2->text);
 
         $this->assertEquals($user3->id, $message3->useridfrom);
-        $this->assertContains('Writing PHPUnit tests!', $message3->text);
+        $this->assertStringContainsString('Writing PHPUnit tests!', $message3->text);
 
         $this->assertEquals($user1->id, $message4->useridfrom);
-        $this->assertContains('Word.', $message4->text);
+        $this->assertStringContainsString('Word.', $message4->text);
 
         $this->assertEquals($user2->id, $message5->useridfrom);
-        $this->assertContains('Yeah!', $message5->text);
+        $this->assertStringContainsString('Yeah!', $message5->text);
 
         // Confirm the members data is correct.
         $members = $convmessages['members'];
@@ -2457,10 +2457,10 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
         $message3 = $messages[2];
         $message4 = $messages[3];
 
-        $this->assertContains('Message 1', $message1->text);
-        $this->assertContains('Message 2', $message2->text);
-        $this->assertContains('Message 3', $message3->text);
-        $this->assertContains('Message 4', $message4->text);
+        $this->assertStringContainsString('Message 1', $message1->text);
+        $this->assertStringContainsString('Message 2', $message2->text);
+        $this->assertStringContainsString('Message 3', $message3->text);
+        $this->assertStringContainsString('Message 4', $message4->text);
 
         // Confirm the members data is correct.
         $members = $convmessages['members'];
@@ -2480,8 +2480,8 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
         $message1 = $messages[0];
         $message2 = $messages[1];
 
-        $this->assertContains('Message 3', $message1->text);
-        $this->assertContains('Message 4', $message2->text);
+        $this->assertStringContainsString('Message 3', $message1->text);
+        $this->assertStringContainsString('Message 4', $message2->text);
 
         // Confirm the members data is correct.
         $members = $convmessages['members'];
@@ -2530,10 +2530,10 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
         $message3 = $messages[2];
         $message4 = $messages[3];
 
-        $this->assertContains('Message 1', $message1->text);
-        $this->assertContains('Message 2', $message2->text);
-        $this->assertContains('Message 3', $message3->text);
-        $this->assertContains('Message 4', $message4->text);
+        $this->assertStringContainsString('Message 1', $message1->text);
+        $this->assertStringContainsString('Message 2', $message2->text);
+        $this->assertStringContainsString('Message 3', $message3->text);
+        $this->assertStringContainsString('Message 4', $message4->text);
 
         // Confirm the members data is correct.
         $members = $convmessages['members'];
@@ -2553,8 +2553,8 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
         $message1 = $messages[0];
         $message2 = $messages[1];
 
-        $this->assertContains('Message 1', $message1->text);
-        $this->assertContains('Message 2', $message2->text);
+        $this->assertStringContainsString('Message 1', $message1->text);
+        $this->assertStringContainsString('Message 2', $message2->text);
 
         // Confirm the members data is correct.
         $members = $convmessages['members'];
@@ -2601,8 +2601,8 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
         $message1 = $messages[0];
         $message2 = $messages[1];
 
-        $this->assertContains('Message 2', $message1->text);
-        $this->assertContains('Message 3', $message2->text);
+        $this->assertStringContainsString('Message 2', $message1->text);
+        $this->assertStringContainsString('Message 3', $message2->text);
 
         // Confirm the members data is correct.
         $members = $convmessages['members'];
@@ -2649,8 +2649,8 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
         $message1 = $messages[0];
         $message2 = $messages[1];
 
-        $this->assertContains('Message 3', $message1->text);
-        $this->assertContains('Message 4', $message2->text);
+        $this->assertStringContainsString('Message 3', $message1->text);
+        $this->assertStringContainsString('Message 4', $message2->text);
 
         // Confirm the members data is correct.
         $members = $convmessages['members'];
@@ -2696,7 +2696,7 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
 
         $message1 = $messages[0];
 
-        $this->assertContains('Message 3', $message1->text);
+        $this->assertStringContainsString('Message 3', $message1->text);
 
         // Confirm the members data is correct.
         $members = $convmessages['members'];
@@ -2733,7 +2733,7 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
 
         // Check the results are correct.
         $this->assertEquals($user2->id, $message->useridfrom);
-        $this->assertContains('Word.', $message->text);
+        $this->assertStringContainsString('Word.', $message->text);
     }
 
     /**
index 3eda274..95985a3 100644 (file)
@@ -2812,16 +2812,16 @@ class core_message_externallib_testcase extends externallib_advanced_testcase {
         $message4 = $messages[3];
 
         $this->assertEquals($user1->id, $message1['useridfrom']);
-        $this->assertContains('Yo!', $message1['text']);
+        $this->assertStringContainsString('Yo!', $message1['text']);
 
         $this->assertEquals($user3->id, $message2['useridfrom']);
-        $this->assertContains('Sup mang?', $message2['text']);
+        $this->assertStringContainsString('Sup mang?', $message2['text']);
 
         $this->assertEquals($user2->id, $message3['useridfrom']);
-        $this->assertContains('Writing PHPUnit tests!', $message3['text']);
+        $this->assertStringContainsString('Writing PHPUnit tests!', $message3['text']);
 
         $this->assertEquals($user1->id, $message4['useridfrom']);
-        $this->assertContains('Word.', $message4['text']);
+        $this->assertStringContainsString('Word.', $message4['text']);
     }
 
     /**
@@ -2870,9 +2870,9 @@ class core_message_externallib_testcase extends externallib_advanced_testcase {
         $message2 = $messages[1];
         $message3 = $messages[2];
 
-        $this->assertContains('Message 2', $message1['text']);
-        $this->assertContains('Message 3', $message2['text']);
-        $this->assertContains('Message 4', $message3['text']);
+        $this->assertStringContainsString('Message 2', $message1['text']);
+        $this->assertStringContainsString('Message 3', $message2['text']);
+        $this->assertStringContainsString('Message 4', $message3['text']);
 
         // Confirm the members data is correct.
         $members = $result['members'];
@@ -2936,16 +2936,16 @@ class core_message_externallib_testcase extends externallib_advanced_testcase {
         $message4 = $messages[3];
 
         $this->assertEquals($user1->id, $message1['useridfrom']);
-        $this->assertContains('Yo!', $message1['text']);
+        $this->assertStringContainsString('Yo!', $message1['text']);
 
         $this->assertEquals($user3->id, $message2['useridfrom']);
-        $this->assertContains('Sup mang?', $message2['text']);
+        $this->assertStringContainsString('Sup mang?', $message2['text']);
 
         $this->assertEquals($user2->id, $message3['useridfrom']);
-        $this->assertContains('Writing PHPUnit tests!', $message3['text']);
+        $this->assertStringContainsString('Writing PHPUnit tests!', $message3['text']);
 
         $this->assertEquals($user1->id, $message4['useridfrom']);
-        $this->assertContains('Word.', $message4['text']);
+        $this->assertStringContainsString('Word.', $message4['text']);
     }
 
     /**
index 2cfe8d5..d89b195 100644 (file)
@@ -133,7 +133,7 @@ class assignfeedback_comments_privacy_testcase extends \mod_assign\tests\mod_ass
         // The student should be able to see the teachers feedback.
         $exportdata = new \mod_assign\privacy\assign_plugin_request_data($context, $assign, $grade, [], $user1);
         \assignfeedback_comments\privacy\provider::export_feedback_user_data($exportdata);
-        $this->assertContains($feedbacktext, $writer->get_data(['Feedback comments'])->commenttext);
+        $this->assertStringContainsString($feedbacktext, $writer->get_data(['Feedback comments'])->commenttext);
 
         $filespath = [];
         $filespath[] = 'Feedback comments';
@@ -145,7 +145,7 @@ class assignfeedback_comments_privacy_testcase extends \mod_assign\tests\mod_ass
         // The teacher should also be able to see the feedback that they provided.
         $exportdata = new \mod_assign\privacy\assign_plugin_request_data($context, $assign, $grade, [], $user2);
         \assignfeedback_comments\privacy\provider::export_feedback_user_data($exportdata);
-        $this->assertContains($feedbacktext, $writer->get_data(['Feedback comments'])->commenttext);
+        $this->assertStringContainsString($feedbacktext, $writer->get_data(['Feedback comments'])->commenttext);
 
         $feedbackfile = $writer->get_files($filespath)['feedback1.txt'];
 
index 3b8bda4..920890e 100644 (file)
@@ -366,7 +366,7 @@ class assignfeedback_editpdf_testcase extends advanced_testcase {
         $output = ob_get_clean();
 
         // Verify it acted on both submissions in the queue.
-        $this->assertContains("Convert 1 submission attempt(s) for assignment {$assign->get_instance()->id}", $output);
+        $this->assertStringContainsString("Convert 1 submission attempt(s) for assignment {$assign->get_instance()->id}", $output);
         $this->assertEquals(0, $DB->count_records('assignfeedback_editpdf_queue'));
 
         // Set a known limit.
@@ -390,7 +390,7 @@ class assignfeedback_editpdf_testcase extends advanced_testcase {
         $output = ob_get_clean();
 
         // Verify that the cron task skipped the submission.
-        $this->assertNotContains("Convert 1 submission attempt(s) for assignment {$assign->get_instance()->id}", $output);
+        $this->assertStringNotContainsString("Convert 1 submission attempt(s) for assignment {$assign->get_instance()->id}", $output);
         // And it removed it from the queue.
         $this->assertEquals(0, $DB->count_records('assignfeedback_editpdf_queue'));
 
index e30e7ee..7f1acba 100644 (file)
@@ -221,8 +221,8 @@ class assignsubmission_comments_privacy_testcase extends \mod_assign\tests\mod_a
             $exportedteachercomment = $exportedcomments->comments[0]->content;
         }
         $this->assertCount(2, $exportedcomments->comments);
-        $this->assertContains($studentcomment, $exportedstudentcomment);
-        $this->assertContains($teachercomment, $exportedteachercomment);
+        $this->assertStringContainsString($studentcomment, $exportedstudentcomment);
+        $this->assertStringContainsString($teachercomment, $exportedteachercomment);
     }
 
     /**
index 4d734a8..5c6e3ba 100644 (file)
@@ -229,7 +229,7 @@ class mod_assign_external_testcase extends externallib_advanced_testcase {
         $this->assertEquals($assign1->id, $assignment['id']);
         $this->assertEquals($course1->id, $assignment['course']);
         $this->assertEquals('English', $assignment['name']);
-        $this->assertContains('the assignment intro text here', $assignment['intro']);
+        $this->assertStringContainsString('the assignment intro text here', $assignment['intro']);
         $this->assertNotEmpty($assignment['configs']);
         // Check the url of the file attatched.
         $this->assertRegExp('@"' . $CFG->wwwroot . '/webservice/pluginfile.php/\d+/mod_assign/intro/intro\.txt"@', $assignment['intro']);
index 31c65ac..31831a5 100644 (file)
@@ -219,7 +219,7 @@ class mod_assign_locallib_testcase extends advanced_testcase {
         $output = $assign->get_renderer()->render($gradingtable);
 
         // Test that the filter function does not throw errors for assignments with no grade.
-        $this->assertContains(get_string('nothingtodisplay'), $output);
+        $this->assertStringContainsString(get_string('nothingtodisplay'), $output);
     }
 
 
@@ -249,16 +249,16 @@ class mod_assign_locallib_testcase extends advanced_testcase {
         // Check that the assignment is late.
         $gradingtable = new assign_grading_table($assign, 1, '', 0, true);
         $output = $assign->get_renderer()->render($gradingtable);
-        $this->assertContains(get_string('submissionstatus_', 'assign'), $output);
-        $this->assertContains(get_string('overdue', 'assign', format_time((4 * DAYSECS))), $output);
+        $this->assertStringContainsString(get_string('submissionstatus_', 'assign'), $output);
+        $this->assertStringContainsString(get_string('overdue', 'assign', format_time((4 * DAYSECS))), $output);
 
         // Grant an extension.
         $extendedtime = $time + (2 * DAYSECS);
         $assign->testable_save_user_extension($student->id, $extendedtime);
         $gradingtable = new assign_grading_table($assign, 1, '', 0, true);
         $output = $assign->get_renderer()->render($gradingtable);
-        $this->assertContains(get_string('submissionstatus_', 'assign'), $output);
-        $this->assertContains(get_string('userextensiondate', 'assign', userdate($extendedtime)), $output);
+        $this->assertStringContainsString(get_string('submissionstatus_', 'assign'), $output);
+        $this->assertStringContainsString(get_string('userextensiondate', 'assign', userdate($extendedtime)), $output);
 
         // Simulate a submission.
         $this->setUser($student);
@@ -278,8 +278,8 @@ class mod_assign_locallib_testcase extends advanced_testcase {
         $this->setUser($teacher);
         $gradingtable = new assign_grading_table($assign, 1, '', 0, true);
         $output = $assign->get_renderer()->render($gradingtable);
-        $this->assertContains(get_string('submissionstatus_submitted', 'assign'), $output);
-        $this->assertContains(get_string('userextensiondate', 'assign', userdate($extendedtime)), $output);
+        $this->assertStringContainsString(get_string('submissionstatus_submitted', 'assign'), $output);
+        $this->assertStringContainsString(get_string('userextensiondate', 'assign', userdate($extendedtime)), $output);
     }
 
     /**
@@ -308,18 +308,18 @@ class mod_assign_locallib_testcase extends advanced_testcase {
         // Check that the assignment is late.
         $gradingtable = new assign_grading_table($assign, 1, '', 0, true);
         $output = $assign->get_renderer()->render($gradingtable);
-        $this->assertContains(get_string('submissionstatus_', 'assign'), $output);
+        $this->assertStringContainsString(get_string('submissionstatus_', 'assign'), $output);
         $difftime = time() - $time;
-        $this->assertContains(get_string('overdue', 'assign', format_time((4 * DAYSECS) + $difftime)), $output);
+        $this->assertStringContainsString(get_string('overdue', 'assign', format_time((4 * DAYSECS) + $difftime)), $output);
 
         // Grant an extension that is in the past.
         $assign->testable_save_user_extension($student->id, $time - (2 * DAYSECS));
         $gradingtable = new assign_grading_table($assign, 1, '', 0, true);
         $output = $assign->get_renderer()->render($gradingtable);
-        $this->assertContains(get_string('submissionstatus_', 'assign'), $output);
-        $this->assertContains(get_string('userextensiondate', 'assign', userdate($time - (2 * DAYSECS))), $output);
+        $this->assertStringContainsString(get_string('submissionstatus_', 'assign'), $output);
+        $this->assertStringContainsString(get_string('userextensiondate', 'assign', userdate($time - (2 * DAYSECS))), $output);
         $difftime = time() - $time;
-        $this->assertContains(get_string('overdue', 'assign', format_time((2 * DAYSECS) + $difftime)), $output);
+        $this->assertStringContainsString(get_string('overdue', 'assign', format_time((2 * DAYSECS) + $difftime)), $output);
 
         // Simulate a submission.
         $this->setUser($student);
@@ -340,11 +340,11 @@ class mod_assign_locallib_testcase extends advanced_testcase {
         $this->setUser($teacher);
         $gradingtable = new assign_grading_table($assign, 1, '', 0, true);
         $output = $assign->get_renderer()->render($gradingtable);
-        $this->assertContains(get_string('submissionstatus_submitted', 'assign'), $output);
-        $this->assertContains(get_string('userextensiondate', 'assign', userdate($time - (2 * DAYSECS))), $output);
+        $this->assertStringContainsString(get_string('submissionstatus_submitted', 'assign'), $output);
+        $this->assertStringContainsString(get_string('userextensiondate', 'assign', userdate($time - (2 * DAYSECS))), $output);
 
         $difftime = $submittedtime - $time;
-        $this->assertContains(get_string('submittedlateshort', 'assign', format_time((2 * DAYSECS) + $difftime)), $output);
+        $this->assertStringContainsString(get_string('submittedlateshort', 'assign', format_time((2 * DAYSECS) + $difftime)), $output);
     }
 
     public function test_gradingtable_status_rendering() {
@@ -370,9 +370,9 @@ class mod_assign_locallib_testcase extends advanced_testcase {
         // Check that the assignment is late.
         $gradingtable = new assign_grading_table($assign, 1, '', 0, true);
         $output = $assign->get_renderer()->render($gradingtable);
-        $this->assertContains(get_string('submissionstatus_', 'assign'), $output);
+        $this->assertStringContainsString(get_string('submissionstatus_', 'assign'), $output);
         $difftime = time() - $time;
-        $this->assertContains(get_string('overdue', 'assign', format_time((4 * DAYSECS) + $difftime)), $output);
+        $this->assertStringContainsString(get_string('overdue', 'assign', format_time((4 * DAYSECS) + $difftime)), $output);
 
         // Simulate a student viewing the assignment without submitting.
         $this->setUser($student);
@@ -386,7 +386,7 @@ class mod_assign_locallib_testcase extends advanced_testcase {
         $gradingtable = new assign_grading_table($assign, 1, '', 0, true);
         $output = $assign->get_renderer()->render($gradingtable);
         $difftime = $submittedtime - $time;
-        $this->assertContains(get_string('overdue', 'assign', format_time((4 * DAYSECS) + $difftime)), $output);
+        $this->assertStringContainsString(get_string('overdue', 'assign', format_time((4 * DAYSECS) + $difftime)), $output);
 
         $document = new DOMDocument();
         @$document->loadHTML($output);
@@ -763,7 +763,7 @@ class mod_assign_locallib_testcase extends advanced_testcase {
         assign::cron();
         $event = $DB->get_record('event', $params);
 
-        $this->assertContains('Some text', $event->description);
+        $this->assertStringContainsString('Some text', $event->description);
 
     }
 
@@ -805,7 +805,7 @@ class mod_assign_locallib_testcase extends advanced_testcase {
         // Test you cannot see the submit button for an offline assignment regardless.
         $this->setUser($student);
         $output = $assign->view_student_summary($student, true);
-        $this->assertNotContains(get_string('submitassignment', 'assign'), $output, 'Can submit empty offline assignment');
+        $this->assertStringNotContainsString(get_string('submitassignment', 'assign'), $output, 'Can submit empty offline assignment');
     }
 
     public function test_cannot_submit_empty_no_submission() {
@@ -826,7 +826,7 @@ class mod_assign_locallib_testcase extends advanced_testcase {
         // Test you cannot see the submit button for an online text assignment with no submission.
         $this->setUser($student);
         $output = $assign->view_student_summary($student, true);
-        $this->assertNotContains(get_string('submitassignment', 'assign'), $output, 'Cannot submit empty onlinetext assignment');
+        $this->assertStringNotContainsString(get_string('submitassignment', 'assign'), $output, 'Cannot submit empty onlinetext assignment');
     }
 
     public function test_can_submit_with_submission() {
@@ -850,7 +850,7 @@ class mod_assign_locallib_testcase extends advanced_testcase {
         // Test you can see the submit button for an online text assignment with a submission.
         $this->setUser($student);
         $output = $assign->view_student_summary($student, true);
-        $this->assertContains(get_string('submitassignment', 'assign'), $output, 'Can submit non empty onlinetext assignment');
+        $this->assertStringContainsString(get_string('submitassignment', 'assign'), $output, 'Can submit non empty onlinetext assignment');
     }
 
     /**
@@ -1926,7 +1926,7 @@ class mod_assign_locallib_testcase extends advanced_testcase {
         // Check we can see the submit button.
         $this->setUser($student);
         $output = $assign->view_student_summary($student, true);
-        $this->assertContains(get_string('submitassignment', 'assign'), $output);
+        $this->assertStringContainsString(get_string('submitassignment', 'assign'), $output);
 
         $submission = $assign->get_group_submission($student->id, 0, true);
         $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
@@ -1934,18 +1934,18 @@ class mod_assign_locallib_testcase extends advanced_testcase {
 
         // Check that the student does not see "Submit" button.
         $output = $assign->view_student_summary($student, true);
-        $this->assertNotContains(get_string('submitassignment', 'assign'), $output);
+        $this->assertStringNotContainsString(get_string('submitassignment', 'assign'), $output);
 
         // Change to another user in the same group.
         $this->setUser($otherstudent);
         $output = $assign->view_student_summary($otherstudent, true);
-        $this->assertContains(get_string('submitassignment', 'assign'), $output);
+        $this->assertStringContainsString(get_string('submitassignment', 'assign'), $output);
 
         $submission = $assign->get_group_submission($otherstudent->id, 0, true);
         $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
         $assign->testable_update_submission($submission, $otherstudent->id, true, true);
         $output = $assign->view_student_summary($otherstudent, true);
-        $this->assertNotContains(get_string('submitassignment', 'assign'), $output);
+        $this->assertStringNotContainsString(get_string('submitassignment', 'assign'), $output);
     }
 
     public function test_group_submissions_submit_for_marking() {
@@ -1981,10 +1981,10 @@ class mod_assign_locallib_testcase extends advanced_testcase {
 
         // Check we can see the submit button.
         $output = $assign->view_student_summary($student, true);
-        $this->assertContains(get_string('submitassignment', 'assign'), $output);
-        $this->assertContains(get_string('timeremaining', 'assign'), $output);
+        $this->assertStringContainsString(get_string('submitassignment', 'assign'), $output);
+        $this->assertStringContainsString(get_string('timeremaining', 'assign'), $output);
         $difftime = time() - $time;
-        $this->assertContains(get_string('overdue', 'assign', format_time((2 * DAYSECS) + $difftime)), $output);
+        $this->assertStringContainsString(get_string('overdue', 'assign', format_time((2 * DAYSECS) + $difftime)), $output);
 
         $submission = $assign->get_group_submission($student->id, 0, true);
         $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
@@ -1992,23 +1992,23 @@ class mod_assign_locallib_testcase extends advanced_testcase {
 
         // Check that the student does not see "Submit" button.
         $output = $assign->view_student_summary($student, true);
-        $this->assertNotContains(get_string('submitassignment', 'assign'), $output);
+        $this->assertStringNotContainsString(get_string('submitassignment', 'assign'), $output);
 
         // Change to another user in the same group.
         $this->setUser($otherstudent);
         $output = $assign->view_student_summary($otherstudent, true);
-        $this->assertNotContains(get_string('submitassignment', 'assign'), $output);
+        $this->assertStringNotContainsString(get_string('submitassignment', 'assign'), $output);
 
         // Check that time remaining is not overdue.
-        $this->assertContains(get_string('timeremaining', 'assign'), $output);
+        $this->assertStringContainsString(get_string('timeremaining', 'assign'), $output);
         $difftime = time() - $time;
-        $this->assertContains(get_string('submittedlate', 'assign', format_time((2 * DAYSECS) + $difftime)), $output);
+        $this->assertStringContainsString(get_string('submittedlate', 'assign', format_time((2 * DAYSECS) + $difftime)), $output);
 
         $submission = $assign->get_group_submission($otherstudent->id, 0, true);
         $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
         $assign->testable_update_submission($submission, $otherstudent->id, true, true);
         $output = $assign->view_student_summary($otherstudent, true);
-        $this->assertNotContains(get_string('submitassignment', 'assign'), $output);
+        $this->assertStringNotContainsString(get_string('submitassignment', 'assign'), $output);
     }
 
     public function test_submissions_open() {
@@ -2824,7 +2824,7 @@ class mod_assign_locallib_testcase extends advanced_testcase {
 
         $this->setUser($student);
         $output = $assign->view_student_summary($student, true);
-        $this->assertContains('Student submission text', $output, 'Contains student submission text');
+        $this->assertStringContainsString('Student submission text', $output, 'Contains student submission text');
 
         // Check that a teacher can not edit the submission as they do not have the capability.
         $this->setUser($teacher);
@@ -2863,7 +2863,7 @@ class mod_assign_locallib_testcase extends advanced_testcase {
 
         $this->setUser($student);
         $output = $assign->view_student_summary($student, true);
-        $this->assertContains('Student submission text', $output, 'Contains student submission text');
+        $this->assertStringContainsString('Student submission text', $output, 'Contains student submission text');
 
         // Check that a teacher can edit the submission.
         $this->setUser($teacher);
@@ -2871,8 +2871,8 @@ class mod_assign_locallib_testcase extends advanced_testcase {
 
         $this->setUser($student);
         $output = $assign->view_student_summary($student, true);
-        $this->assertNotContains('Student submission text', $output, 'Contains student submission text');
-        $this->assertContains('Teacher edited submission text', $output, 'Contains teacher edited submission text');
+        $this->assertStringNotContainsString('Student submission text', $output, 'Contains student submission text');
+        $this->assertStringContainsString('Teacher edited submission text', $output, 'Contains teacher edited submission text');
 
         // Check that the teacher can submit the students work.
         $this->setUser($teacher);
@@ -2885,13 +2885,13 @@ class mod_assign_locallib_testcase extends advanced_testcase {
 
         // Check that the submission text was saved.
         $output = $assign->view_student_summary($student, true);
-        $this->assertContains('Teacher edited submission text', $output, 'Contains student submission text');
+        $this->assertStringContainsString('Teacher edited submission text', $output, 'Contains student submission text');
 
         // Check that the student can submit their work.
         $this->submit_for_grading($student, $assign, []);
 
         $output = $assign->view_student_summary($student, true);
-        $this->assertNotContains(get_string('addsubmission', 'assign'), $output);
+        $this->assertStringNotContainsString(get_string('addsubmission', 'assign'), $output);
 
         // An editing teacher without the extra role should still be able to revert to draft.
         $this->setUser($otherteacher);
@@ -2942,9 +2942,9 @@ class mod_assign_locallib_testcase extends advanced_testcase {
 
         $this->setUser($student);
         $output = $assign->view_student_summary($student, true);
-        $this->assertNotContains($output, get_string('editsubmission', 'assign'),
+        $this->assertStringNotContainsString($output, get_string('editsubmission', 'assign'),
                                  'Should not be able to edit after cutoff date.');
-        $this->assertNotContains($output, get_string('submitassignment', 'assign'),
+        $this->assertStringNotContainsString($output, get_string('submitassignment', 'assign'),
                                  'Should not be able to submit after cutoff date.');
     }
 
@@ -3649,7 +3649,7 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
             ];
 
         $result = $assign->testable_process_save_quick_grades($data);
-        $this->assertContains(get_string('quickgradingchangessaved', 'assign'), $result);
+        $this->assertStringContainsString(get_string('quickgradingchangessaved', 'assign'), $result);
         $grade = $assign->get_user_grade($student->id, false);
         $this->assertEquals(60.0, $grade->grade);
 
@@ -3661,7 +3661,7 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
             'quickgrade_' . $student->id => '50.0'
         );
         $result = $assign->testable_process_save_quick_grades($data);
-        $this->assertContains(get_string('errorrecordmodified', 'assign'), $result);
+        $this->assertStringContainsString(get_string('errorrecordmodified', 'assign'), $result);
         $grade = $assign->get_user_grade($student->id, false);
         $this->assertFalse($grade);
 
@@ -3673,7 +3673,7 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
             'quickgrade_' . $student->id => '40.0'
         );
         $result = $assign->testable_process_save_quick_grades($data);
-        $this->assertContains(get_string('quickgradingchangessaved', 'assign'), $result);
+        $this->assertStringContainsString(get_string('quickgradingchangessaved', 'assign'), $result);
         $grade = $assign->get_user_grade($student->id, false);
         $this->assertEquals(40.0, $grade->grade);
 
@@ -3687,13 +3687,13 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
             'quickgrade_' . $student->id => '30.0'
         );
         $result = $assign->testable_process_save_quick_grades($data);
-        $this->assertContains(get_string('quickgradingchangessaved', 'assign'), $result);
+        $this->assertStringContainsString(get_string('quickgradingchangessaved', 'assign'), $result);
         $grade = $assign->get_user_grade($student->id, false);
         $this->assertEquals(30.0, $grade->grade);
 
         // Now update using 'old' data. Should fail.
         $result = $assign->testable_process_save_quick_grades($pastdata);
-        $this->assertContains(get_string('errorrecordmodified', 'assign'), $result);
+        $this->assertStringContainsString(get_string('errorrecordmodified', 'assign'), $result);
         $grade = $assign->get_user_grade($student->id, false);
         $this->assertEquals(30.0, $grade->grade);
     }
@@ -3962,15 +3962,15 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
         // Check that submissionslocked message 'This assignment is not accepting submissions' does not appear for student.
         $gradingtable = new assign_grading_table($assign, 1, '', 0, true);
         $output = $assign->get_renderer()->render($gradingtable);
-        $this->assertContains(get_string('submissionstatus_', 'assign'), $output);
+        $this->assertStringContainsString(get_string('submissionstatus_', 'assign'), $output);
 
         $assignsubmissionstatus = $assign->get_assign_submission_status_renderable($student, true);
         $output2 = $assign->get_renderer()->render($assignsubmissionstatus);
 
         // Check that submissionslocked 'This assignment is not accepting submissions' message does not appear for student.
-        $this->assertNotContains(get_string('submissionslocked', 'assign'), $output2);
+        $this->assertStringNotContainsString(get_string('submissionslocked', 'assign'), $output2);
         // Check that submissionstatus_marked 'Graded' message does appear for student.
-        $this->assertContains(get_string('submissionstatus_marked', 'assign'), $output2);
+        $this->assertStringContainsString(get_string('submissionstatus_marked', 'assign'), $output2);
     }
 
     /**
@@ -4188,17 +4188,17 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
         $this->setUser($student2);
         $summary = $assign->get_assign_grading_summary_renderable($group1->id);
         $output1 .= $assign->get_renderer()->render($summary);
-        $this->assertContains('Tuesday, 28 May 2019, 7:31 AM', $output1, '', true);
+        $this->assertStringContainsStringIgnoringCase('Tuesday, 28 May 2019, 7:31 AM', $output1);
 
         $output2 = '';
         // Teacher should be able to see all group override duedate.
         $this->setUser($teacher);
         $summary = $assign->get_assign_grading_summary_renderable($group1->id);
         $output2 .= $assign->get_renderer()->render($summary);
-        $this->assertContains('Friday, 20 September 2019, 10:37 PM', $output2, '', true);
+        $this->assertStringContainsStringIgnoringCase('Friday, 20 September 2019, 10:37 PM', $output2);
         $summary = $assign->get_assign_grading_summary_renderable($group2->id);
         $output3 = '';
         $output3 .= $assign->get_renderer()->render($summary);
-        $this->assertContains('Friday, 7 June 2019, 5:37 PM', $output3, '', true);
+        $this->assertStringContainsStringIgnoringCase('Friday, 7 June 2019, 5:37 PM', $output3);
     }
 }
index fe2f9aa..cd7edb9 100644 (file)
@@ -318,8 +318,8 @@ class mod_assign_privacy_testcase extends provider_testcase {
         $this->assertEquals((float)$grade1, $writer->get_data(['attempt 1', 'grade'])->grade);
         $this->assertEquals((float)$grade2, $writer->get_data(['attempt 2', 'grade'])->grade);
         // Check feedback.
-        $this->assertContains($teachercommenttext, $writer->get_data(['attempt 1', 'Feedback comments'])->commenttext);
-        $this->assertContains($teachercommenttext2, $writer->get_data(['attempt 2', 'Feedback comments'])->commenttext);
+        $this->assertStringContainsString($teachercommenttext, $writer->get_data(['attempt 1', 'Feedback comments'])->commenttext);
+        $this->assertStringContainsString($teachercommenttext2, $writer->get_data(['attempt 2', 'Feedback comments'])->commenttext);
 
         // Check override data was exported correctly.
         $overrideexport = $writer->get_data(['Overrides']);
@@ -431,11 +431,11 @@ class mod_assign_privacy_testcase extends provider_testcase {
         $student2grade2 = $writer->get_data(['studentsubmissions', $user2->id, 'attempt 2', 'grade']);
         $this->assertEquals((float)$grade3, $student2grade2->grade);
         // Check for feedback given to students.
-        $this->assertContains($teachercommenttext, $writer->get_data(['studentsubmissions', $user1->id, 'attempt 1',
+        $this->assertStringContainsString($teachercommenttext, $writer->get_data(['studentsubmissions', $user1->id, 'attempt 1',
                 'Feedback comments'])->commenttext);
-        $this->assertContains($teachercommenttext2, $writer->get_data(['studentsubmissions', $user2->id, 'attempt 1',
+        $this->assertStringContainsString($teachercommenttext2, $writer->get_data(['studentsubmissions', $user2->id, 'attempt 1',
                 'Feedback comments'])->commenttext);
-        $this->assertContains($teachercommenttext3, $writer->get_data(['studentsubmissions', $user2->id, 'attempt 2',
+        $this->assertStringContainsString($teachercommenttext3, $writer->get_data(['studentsubmissions', $user2->id, 'attempt 2',
                 'Feedback comments'])->commenttext);
     }
 
index ef43165..c4ae832 100644 (file)
@@ -1000,10 +1000,10 @@ class mod_data_lib_testcase extends advanced_testcase {
 
         // Admin can see everything.
         $res = mod_data_get_tagged_records($tag, false, 0, 0, 1, 0);
-        $this->assertContains('value11', $res->content);
-        $this->assertContains('value12', $res->content);
-        $this->assertContains('value13', $res->content);
-        $this->assertNotContains('value14', $res->content);
+        $this->assertStringContainsString('value11', $res->content);
+        $this->assertStringContainsString('value12', $res->content);
+        $this->assertStringContainsString('value13', $res->content);
+        $this->assertStringNotContainsString('value14', $res->content);
     }
 
     public function test_mod_data_get_tagged_records_approval() {
@@ -1032,8 +1032,8 @@ class mod_data_lib_testcase extends advanced_testcase {
 
         // Admin can see everything.
         $res = mod_data_get_tagged_records($tag, false, 0, 0, 1, 0);
-        $this->assertContains('value11', $res->content);
-        $this->assertContains('value21', $res->content);
+        $this->assertStringContainsString('value11', $res->content);
+        $this->assertStringContainsString('value21', $res->content);
         $this->assertEmpty($res->prevpageurl);
         $this->assertEmpty($res->nextpageurl);
 
@@ -1048,8 +1048,8 @@ class mod_data_lib_testcase extends advanced_testcase {
         core_tag_index_builder::reset_caches();
         $res = mod_data_get_tagged_records($tag, false, 0, 0, 1, 0);
 
-        $this->assertContains('value11', $res->content);
-        $this->assertNotContains('value21', $res->content);
+        $this->assertStringContainsString('value11', $res->content);
+        $this->assertStringNotContainsString('value21', $res->content);
 
         $recordtoupdate = new stdClass();
         $recordtoupdate->id = $record21;
@@ -1059,8 +1059,8 @@ class mod_data_lib_testcase extends advanced_testcase {
         core_tag_index_builder::reset_caches();
         $res = mod_data_get_tagged_records($tag, false, 0, 0, 1, 0);
 
-        $this->assertContains('value11', $res->content);
-        $this->assertContains('value21', $res->content);
+        $this->assertStringContainsString('value11', $res->content);
+        $this->assertStringContainsString('value21', $res->content);
     }
 
     public function test_mod_data_get_tagged_records_time() {
@@ -1093,8 +1093,8 @@ class mod_data_lib_testcase extends advanced_testcase {
 
         // Admin can see everything.
         $res = mod_data_get_tagged_records($tag, false, 0, 0, 1, 0);
-        $this->assertContains('value11', $res->content);
-        $this->assertContains('value21', $res->content);
+        $this->assertStringContainsString('value11', $res->content);
+        $this->assertStringContainsString('value21', $res->content);
         $this->assertEmpty($res->prevpageurl);
         $this->assertEmpty($res->nextpageurl);
 
@@ -1109,8 +1109,8 @@ class mod_data_lib_testcase extends advanced_testcase {
         core_tag_index_builder::reset_caches();
         $res = mod_data_get_tagged_records($tag, false, 0, 0, 1, 0);
 
-        $this->assertContains('value11', $res->content);
-        $this->assertNotContains('value21', $res->content);
+        $this->assertStringContainsString('value11', $res->content);
+        $this->assertStringNotContainsString('value21', $res->content);
 
         $data2->timeviewto = time() + YEARSECS;
         $DB->update_record('data', $data2);
@@ -1118,8 +1118,8 @@ class mod_data_lib_testcase extends advanced_testcase {
         core_tag_index_builder::reset_caches();
         $res = mod_data_get_tagged_records($tag, false, 0, 0, 1, 0);
 
-        $this->assertContains('value11', $res->content);
-        $this->assertContains('value21', $res->content);
+        $this->assertStringContainsString('value11', $res->content);
+        $this->assertStringContainsString('value21', $res->content);
     }
 
     public function test_mod_data_get_tagged_records_course_enrolment() {
@@ -1148,8 +1148,8 @@ class mod_data_lib_testcase extends advanced_testcase {
 
         // Admin can see everything.
         $res = mod_data_get_tagged_records($tag, false, 0, 0, 1, 0);
-        $this->assertContains('value11', $res->content);
-        $this->assertContains('value21', $res->content);
+        $this->assertStringContainsString('value11', $res->content);
+        $this->assertStringContainsString('value21', $res->content);
         $this->assertEmpty($res->prevpageurl);
         $this->assertEmpty($res->nextpageurl);
 
@@ -1164,16 +1164,16 @@ class mod_data_lib_testcase extends advanced_testcase {
         $coursecontext = context_course::instance($course1->id);
         $res = mod_data_get_tagged_records($tag, false, 0, 0, 1, 0);
 
-        $this->assertContains('value11', $res->content);
-        $this->assertNotContains('value21', $res->content);
+        $this->assertStringContainsString('value11', $res->content);
+        $this->assertStringNotContainsString('value21', $res->content);
 
         $this->getDataGenerator()->enrol_user($student->id, $course2->id, $studentrole->id, 'manual');
 
         core_tag_index_builder::reset_caches();
         $res = mod_data_get_tagged_records($tag, false, 0, 0, 1, 0);
 
-        $this->assertContains('value11', $res->content);
-        $this->assertContains('value21', $res->content);
+        $this->assertStringContainsString('value11', $res->content);
+        $this->assertStringContainsString('value21', $res->content);
     }
 
     public function test_mod_data_get_tagged_records_course_groups() {
@@ -1210,9 +1210,9 @@ class mod_data_lib_testcase extends advanced_testcase {
 
         // Admin can see everything.
         $res = mod_data_get_tagged_records($tag, false, 0, 0, 1, 0);
-        $this->assertContains('value11', $res->content);
-        $this->assertContains('value21', $res->content);
-        $this->assertContains('value22', $res->content);
+        $this->assertStringContainsString('value11', $res->content);
+        $this->assertStringContainsString('value21', $res->content);
+        $this->assertStringContainsString('value22', $res->content);
         $this->assertEmpty($res->prevpageurl);
         $this->assertEmpty($res->nextpageurl);
 
@@ -1228,17 +1228,17 @@ class mod_data_lib_testcase extends advanced_testcase {
         // User can search data records inside a course.
         $res = mod_data_get_tagged_records($tag, false, 0, 0, 1, 0);
 
-        $this->assertContains('value11', $res->content);
-        $this->assertContains('value21', $res->content);
-        $this->assertNotContains('value22', $res->content);
+        $this->assertStringContainsString('value11', $res->content);
+        $this->assertStringContainsString('value21', $res->content);
+        $this->assertStringNotContainsString('value22', $res->content);
 
         groups_add_member($groupb, $student);
         core_tag_index_builder::reset_caches();
         $res = mod_data_get_tagged_records($tag, false, 0, 0, 1, 0);
 
-        $this->assertContains('value11', $res->content);
-        $this->assertContains('value21', $res->content);
-        $this->assertContains('value22', $res->content);
+        $this->assertStringContainsString('value11', $res->content);
+        $this->assertStringContainsString('value21', $res->content);
+        $this->assertStringContainsString('value22', $res->content);
     }
 
     /**
index 7d6382f..9603d70 100644 (file)
@@ -190,7 +190,7 @@ class mod_feedback_events_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\mod_feedback\\event\\response_deleted to be triggered without
                     other['anonymous']");
         } catch (coding_exception $e) {
-            $this->assertContains("The 'anonymous' value must be set in other.", $e->getMessage());
+            $this->assertStringContainsString("The 'anonymous' value must be set in other.", $e->getMessage());
         }
     }
 
@@ -297,7 +297,7 @@ class mod_feedback_events_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\mod_feedback\\event\\response_deleted to be triggered without
                     other['instanceid']");
         } catch (coding_exception $e) {
-            $this->assertContains("The 'instanceid' value must be set in other.", $e->getMessage());
+            $this->assertStringContainsString("The 'instanceid' value must be set in other.", $e->getMessage());
         }
 
         // Test not setting cmid.
@@ -312,7 +312,7 @@ class mod_feedback_events_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\mod_feedback\\event\\response_deleted to be triggered without
                     other['cmid']");
         } catch (coding_exception $e) {
-            $this->assertContains("The 'cmid' value must be set in other.", $e->getMessage());
+            $this->assertStringContainsString("The 'cmid' value must be set in other.", $e->getMessage());
         }
 
         // Test not setting anonymous.
@@ -326,7 +326,7 @@ class mod_feedback_events_testcase extends advanced_testcase {
             $this->fail("Event validation should not allow \\mod_feedback\\event\\response_deleted to be triggered without
                     other['anonymous']");
         } catch (coding_exception $e) {
-            $this->assertContains("The 'anonymous' value must be set in other.", $e->getMessage());
+            $this->assertStringContainsString("The 'anonymous' value must be set in other.", $e->getMessage());
         }
     }
 
index ed523db..657b457 100644 (file)
@@ -1685,7 +1685,7 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {
                 $this->assertEquals($thispost['attachment'], 1, "There should be a non-inline attachment");
                 $this->assertCount(1, $thispost['attachments'], "There should be 1 attachment");
                 $this->assertEquals($thispost['attachments'][0]['filename'], $attachfilename, "There should be 1 attachment");
-                $this->assertContains('pluginfile.php', $thispost['message']);
+                $this->assertStringContainsString('pluginfile.php', $thispost['message']);
                 $postfound = true;
                 break;
             }
@@ -1902,8 +1902,8 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {
                 $this->assertEquals($thisdiscussion['attachment'], 1, "There should be a non-inline attachment");
                 $this->assertCount(1, $thisdiscussion['attachments'], "There should be 1 attachment");
                 $this->assertEquals($thisdiscussion['attachments'][0]['filename'], $attachfilename, "There should be 1 attachment");
-                $this->assertNotContains('draftfile.php', $thisdiscussion['message']);
-                $this->assertContains('pluginfile.php', $thisdiscussion['message']);
+                $this->assertStringNotContainsString('draftfile.php', $thisdiscussion['message']);
+                $this->assertStringContainsString('pluginfile.php', $thisdiscussion['message']);
                 $postfound = true;
                 break;
             }
index 26dc9d1..4772a9a 100644 (file)
@@ -959,7 +959,7 @@ class mod_forum_mail_testcase extends advanced_testcase {
         $this->send_notifications_and_assert($author, [$post]);
         $this->send_notifications_and_assert($commenter, [$post]);
         $messages = $this->messagesink->get_messages();
-        $this->assertNotContains($strre, $messages[0]->subject);
+        $this->assertStringNotContainsString($strre, $messages[0]->subject);
         $this->messagesink->clear();
 
         // Replies should have Re: in the subject.
@@ -980,8 +980,8 @@ class mod_forum_mail_testcase extends advanced_testcase {
         $this->send_notifications_and_assert($commenter, [$reply]);
         $this->send_notifications_and_assert($author, [$reply]);
         $messages = $this->messagesink->get_messages();
-        $this->assertContains($strre, $messages[0]->subject);
-        $this->assertContains($strre, $messages[1]->subject);
+        $this->assertStringContainsString($strre, $messages[0]->subject);
+        $this->assertStringContainsString($strre, $messages[1]->subject);
     }
 
     /**
index 0bcae0f..c58ae66 100644 (file)
@@ -398,10 +398,10 @@ class mod_forum_maildigest_testcase extends advanced_testcase {
         $messagecontent = $this->messagesink->get_messages()[0]->fullmessage;
 
         // Assert that the expected name is present (lastname only).
-        $this->assertContains(fullname($user, false), $messagecontent);
+        $this->assertStringContainsString(fullname($user, false), $messagecontent);
 
         // Assert that the full name is not present (firstname lastname only).
-        $this->assertNotContains(fullname($user, true), $messagecontent);
+        $this->assertStringNotContainsString(fullname($user, true), $messagecontent);
     }
 
     /**
@@ -449,10 +449,10 @@ class mod_forum_maildigest_testcase extends advanced_testcase {
         $messagecontent = $this->messagesink->get_messages()[0]->fullmessage;
 
         // Assert that the expected name is present (lastname only).
-        $this->assertContains(fullname($user, false), $messagecontent);
+        $this->assertStringContainsString(fullname($user, false), $messagecontent);
 
         // Assert that the full name is also present (firstname lastname only).
-        $this->assertContains(fullname($user, true), $messagecontent);
+        $this->assertStringContainsString(fullname($user, true), $messagecontent);
     }
 
     /**
index 38bb28e..d25ce90 100644 (file)
@@ -1191,7 +1191,7 @@ class mod_glossary_external_testcase extends externallib_advanced_testcase {
         $aliases = $DB->get_records('glossary_alias', array('entryid' => $return['entryid']));
         $this->assertCount(3, $aliases);
         foreach ($aliases as $alias) {
-            $this->assertContains($alias->alias, $paramaliases);
+            $this->assertStringContainsString($alias->alias, $paramaliases);
         }
     }
 
@@ -1221,7 +1221,7 @@ class mod_glossary_external_testcase extends externallib_advanced_testcase {
         $categories = $DB->get_records('glossary_entries_categories', array('entryid' => $return['entryid']));
         $this->assertCount(2, $categories);
         foreach ($categories as $category) {
-            $this->assertContains($category->categoryid, $paramcategories);
+            $this->assertStringContainsString($category->categoryid, $paramcategories);
         }
     }
 
index 1e7c394..60542b1 100644 (file)
@@ -279,9 +279,9 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
         $xml = $this->get_config_xml(true, 'password');
         $template = $this->create_template($xml);
 
-        $this->assertContains("<key>startURL</key><string>https://safeexambrowser.org/start</string>", $template->get('content'));
-        $this->assertContains("<key>allowQuit</key><true/>", $template->get('content'));
-        $this->assertContains("<key>hashedQuitPassword</key><string>password</string>", $template->get('content'));
+        $this->assertStringContainsString("<key>startURL</key><string>https://safeexambrowser.org/start</string>", $template->get('content'));
+        $this->assertStringContainsString("<key>allowQuit</key><true/>", $template->get('content'));
+        $this->assertStringContainsString("<key>hashedQuitPassword</key><string>password</string>", $template->get('content'));
 
         $quizsettings = quiz_settings::get_record(['quizid' => $this->quiz->id]);
         $quizsettings->set('requiresafeexambrowser', settings_provider::USE_SEB_TEMPLATE);
@@ -289,26 +289,26 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
         $quizsettings->set('allowuserquitseb', 1);
         $quizsettings->save();
 
-        $this->assertContains(
+        $this->assertStringContainsString(
             "<key>startURL</key><string>https://www.example.com/moodle/mod/quiz/view.php?id={$this->quiz->cmid}</string>",
             $quizsettings->get_config()
         );
 
-        $this->assertContains("<key>allowQuit</key><true/>", $quizsettings->get_config());
-        $this->assertNotContains("hashedQuitPassword", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>allowQuit</key><true/>", $quizsettings->get_config());
+        $this->assertStringNotContainsString("hashedQuitPassword", $quizsettings->get_config());
 
         $quizsettings->set('quitpassword', 'new password');
         $quizsettings->save();
         $hashedpassword = hash('SHA256', 'new password');
-        $this->assertContains("<key>allowQuit</key><true/>", $quizsettings->get_config());
-        $this->assertNotContains("<key>hashedQuitPassword</key><string>password</string>", $quizsettings->get_config());
-        $this->assertContains("<key>hashedQuitPassword</key><string>{$hashedpassword}</string>", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>allowQuit</key><true/>", $quizsettings->get_config());
+        $this->assertStringNotContainsString("<key>hashedQuitPassword</key><string>password</string>", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>hashedQuitPassword</key><string>{$hashedpassword}</string>", $quizsettings->get_config());
 
         $quizsettings->set('allowuserquitseb', 0);
         $quizsettings->set('quitpassword', '');
         $quizsettings->save();
-        $this->assertContains("<key>allowQuit</key><false/>", $quizsettings->get_config());
-        $this->assertNotContains("hashedQuitPassword", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>allowQuit</key><false/>", $quizsettings->get_config());
+        $this->assertStringNotContainsString("hashedQuitPassword", $quizsettings->get_config());
     }
 
     /**
@@ -318,9 +318,9 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
         $xml = $this->get_config_xml();
         $template = $this->create_template($xml);
 
-        $this->assertContains("<key>startURL</key><string>https://safeexambrowser.org/start</string>", $template->get('content'));
-        $this->assertNotContains("<key>allowQuit</key><true/>", $template->get('content'));
-        $this->assertNotContains("<key>hashedQuitPassword</key><string>password</string>", $template->get('content'));
+        $this->assertStringContainsString("<key>startURL</key><string>https://safeexambrowser.org/start</string>", $template->get('content'));
+        $this->assertStringNotContainsString("<key>allowQuit</key><true/>", $template->get('content'));
+        $this->assertStringNotContainsString("<key>hashedQuitPassword</key><string>password</string>", $template->get('content'));
 
         $quizsettings = quiz_settings::get_record(['quizid' => $this->quiz->id]);
         $quizsettings->set('requiresafeexambrowser', settings_provider::USE_SEB_TEMPLATE);
@@ -328,20 +328,20 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
         $quizsettings->set('allowuserquitseb', 1);
         $quizsettings->save();
 
-        $this->assertContains("<key>allowQuit</key><true/>", $quizsettings->get_config());
-        $this->assertNotContains("hashedQuitPassword", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>allowQuit</key><true/>", $quizsettings->get_config());
+        $this->assertStringNotContainsString("hashedQuitPassword", $quizsettings->get_config());
 
         $quizsettings->set('quitpassword', 'new password');
         $quizsettings->save();
         $hashedpassword = hash('SHA256', 'new password');
-        $this->assertContains("<key>allowQuit</key><true/>", $quizsettings->get_config());
-        $this->assertContains("<key>hashedQuitPassword</key><string>{$hashedpassword}</string>", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>allowQuit</key><true/>", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>hashedQuitPassword</key><string>{$hashedpassword}</string>", $quizsettings->get_config());
 
         $quizsettings->set('allowuserquitseb', 0);
         $quizsettings->set('quitpassword', '');
         $quizsettings->save();
-        $this->assertContains("<key>allowQuit</key><false/>", $quizsettings->get_config());
-        $this->assertNotContains("hashedQuitPassword", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>allowQuit</key><false/>", $quizsettings->get_config());
+        $this->assertStringNotContainsString("hashedQuitPassword", $quizsettings->get_config());
     }
 
     /**
@@ -357,28 +357,28 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
         $quizsettings->set('quitpassword', '');
         $quizsettings->save();
 
-        $this->assertContains(
+        $this->assertStringContainsString(
             "<key>startURL</key><string>https://www.example.com/moodle/mod/quiz/view.php?id={$this->quiz->cmid}</string>",
             $quizsettings->get_config()
         );
 
-        $this->assertContains("<key>allowQuit</key><true/>", $quizsettings->get_config());
-        $this->assertContains("<key>hashedQuitPassword</key><string>password</string>", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>allowQuit</key><true/>", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>hashedQuitPassword</key><string>password</string>", $quizsettings->get_config());
 
         $quizsettings->set('quitpassword', 'new password');
         $quizsettings->save();
         $hashedpassword = hash('SHA256', 'new password');
 
-        $this->assertNotContains("<key>hashedQuitPassword</key><string>{$hashedpassword}</string>", $quizsettings->get_config());
-        $this->assertContains("<key>allowQuit</key><true/>", $quizsettings->get_config());
-        $this->assertContains("<key>hashedQuitPassword</key><string>password</string>", $quizsettings->get_config());
+        $this->assertStringNotContainsString("<key>hashedQuitPassword</key><string>{$hashedpassword}</string>", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>allowQuit</key><true/>", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>hashedQuitPassword</key><string>password</string>", $quizsettings->get_config());
 
         $quizsettings->set('allowuserquitseb', 0);
         $quizsettings->set('quitpassword', '');
         $quizsettings->save();
 
-        $this->assertContains("<key>allowQuit</key><true/>", $quizsettings->get_config());
-        $this->assertContains("<key>hashedQuitPassword</key><string>password</string>", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>allowQuit</key><true/>", $quizsettings->get_config());
+        $this->assertStringContainsString("<key>hashedQuitPassword</key><string>password</string>", $quizsettings->get_config());
     }
 
     /**
@@ -394,26 +394,26 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
         $quizsettings->set('quitpassword', '');
         $quizsettings->save();
 
-        $this->assertContains(
+        $this->assertStringContainsString(
             "<key>startURL</key><string>https://www.example.com/moodle/mod/quiz/view.php?id={$this->quiz->cmid}</string>",
             $quizsettings->get_config()
         );
 
-        $this->assertNotContains("allowQuit", $quizsettings->get_config());
-        $this->assertNotContains("hashedQuitPassword", $quizsettings->get_config());
+        $this->assertStringNotContainsString("allowQuit", $quizsettings->get_config());
+        $this->assertStringNotContainsString("hashedQuitPassword", $quizsettings->get_config());
 
         $quizsettings->set('quitpassword', 'new password');
         $quizsettings->save();
 
-        $this->assertNotContains("allowQuit", $quizsettings->get_config());
-        $this->assertNotContains("hashedQuitPassword", $quizsettings->get_config());
+        $this->assertStringNotContainsString("allowQuit", $quizsettings->get_config());
+        $this->assertStringNotContainsString("hashedQuitPassword", $quizsettings->get_config());
 
         $quizsettings->set('allowuserquitseb', 0);
         $quizsettings->set('quitpassword', '');
         $quizsettings->save();
 
-        $this->assertNotContains("allowQuit", $quizsettings->get_config());
-        $this->assertNotContains("hashedQuitPassword", $quizsettings->get_config());
+        $this->assertStringNotContainsString("allowQuit", $quizsettings->get_config());
+        $this->assertStringNotContainsString("hashedQuitPassword", $quizsettings->get_config());
     }
 
     /**
index 89c408e..20e2780 100644 (file)
@@ -339,11 +339,11 @@ class quizaccess_seb_rule__testcase extends advanced_testcase {
         // Check that correct error message is returned.
         $errormsg = $this->make_rule()->prevent_access();
         $this->assertNotEmpty($errormsg);
-        $this->assertContains("The config key or browser exam keys could not be validated. "
+        $this->assertStringContainsString("The config key or browser exam keys could not be validated. "
             . "Please ensure you are using the Safe Exam Browser with correct configuration file.", $errormsg);
-        $this->assertContains($this->get_seb_download_link(), $errormsg);
-        $this->assertContains($this->get_seb_launch_link(), $errormsg);
-        $this->assertContains($this->get_seb_config_download_link(), $errormsg);
+        $this->assertStringContainsString($this->get_seb_download_link(), $errormsg);
+        $this->assertStringContainsString($this->get_seb_launch_link(), $errormsg);
+        $this->assertStringContainsString($this->get_seb_config_download_link(), $errormsg);
 
         $events = $sink->get_events();
         $this->assertEquals(1, count($events));
@@ -578,25 +578,25 @@ class quizaccess_seb_rule__testcase extends advanced_testcase {
         // Check that correct error message is returned.
         $errormsg = $this->make_rule()->prevent_access();
         $this->assertNotEmpty($errormsg);
-        $this->assertContains("The config key or browser exam keys could not be validated. "
+        $this->assertStringContainsString("The config key or browser exam keys could not be validated. "
             . "Please ensure you are using the Safe Exam Browser with correct configuration file.", $errormsg);
 
         if ($downloadseblink) {
-            $this->assertContains($this->get_seb_download_link(), $errormsg);
+            $this->assertStringContainsString($this->get_seb_download_link(), $errormsg);
         } else {
-            $this->assertNotContains($this->get_seb_download_link(), $errormsg);
+            $this->assertStringNotContainsString($this->get_seb_download_link(), $errormsg);
         }
 
         if ($launchlink) {
-            $this->assertContains($this->get_seb_launch_link(), $errormsg);
+            $this->assertStringContainsString($this->get_seb_launch_link(), $errormsg);
         } else {
-            $this->assertNotContains($this->get_seb_launch_link(), $errormsg);
+            $this->assertStringNotContainsString($this->get_seb_launch_link(), $errormsg);
         }
 
         if ($downloadconfiglink) {
-            $this->assertContains($this->get_seb_config_download_link(), $errormsg);
+            $this->assertStringContainsString($this->get_seb_config_download_link(), $errormsg);
         } else {
-            $this->assertNotContains($this->get_seb_config_download_link(), $errormsg);
+            $this->assertStringNotContainsString($this->get_seb_config_download_link(), $errormsg);
         }
 
         $events = $sink->get_events();
@@ -740,7 +740,7 @@ class quizaccess_seb_rule__testcase extends advanced_testcase {
         $sink = $this->redirectEvents();
 
         // Check that correct error message is returned.
-        $this->assertContains(
+        $this->assertStringContainsString(
             'This quiz has been configured to use the Safe Exam Browser with client configuration.',
             $this->make_rule()->prevent_access()
         );
@@ -971,7 +971,7 @@ class quizaccess_seb_rule__testcase extends advanced_testcase {
         $method->setAccessible(true);
 
         // The current default contents.
-        $this->assertContains($this->get_seb_download_link(), $method->invoke($this->make_rule()));
+        $this->assertStringContainsString($this->get_seb_download_link(), $method->invoke($this->make_rule()));
 
         set_config('downloadlink', '', 'quizaccess_seb');
 
@@ -993,10 +993,10 @@ class quizaccess_seb_rule__testcase extends advanced_testcase {
         $method = $reflection->getMethod('get_action_buttons');
         $method->setAccessible(true);
 
-        $this->assertContains($this->get_seb_download_link(), $method->invoke($this->make_rule()));
+        $this->assertStringContainsString($this->get_seb_download_link(), $method->invoke($this->make_rule()));
 
         $this->quiz->seb_showsebdownloadlink = 0;
-        $this->assertNotContains($this->get_seb_download_link(), $method->invoke($this->make_rule()));
+        $this->assertStringNotContainsString($this->get_seb_download_link(), $method->invoke($this->make_rule()));
     }
 
     /**
@@ -1016,29 +1016,29 @@ class quizaccess_seb_rule__testcase extends advanced_testcase {
         $quizsettings = quiz_settings::get_record(['quizid' => $this->quiz->id]);
 
         // Should see link when using manually.
-        $this->assertContains($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
-        $this->assertContains($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
+        $this->assertStringContainsString($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
+        $this->assertStringContainsString($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
 
         // Should see links when using template.
         $quizsettings->set('requiresafeexambrowser', settings_provider::USE_SEB_TEMPLATE);
         $quizsettings->set('templateid', $this->create_template()->get('id'));
         $quizsettings->save();
-        $this->assertContains($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
-        $this->assertContains($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
+        $this->assertStringContainsString($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
+        $this->assertStringContainsString($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
 
         // Should see links when using uploaded config.
         $quizsettings->set('requiresafeexambrowser', settings_provider::USE_SEB_UPLOAD_CONFIG);
         $xml = file_get_contents(__DIR__ . '/fixtures/unencrypted.seb');
         $this->create_module_test_file($xml, $this->quiz->cmid);
         $quizsettings->save();
-        $this->assertContains($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
-        $this->assertContains($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
+        $this->assertStringContainsString($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
+        $this->assertStringContainsString($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
 
         // Shouldn't see links if using client config.
         $quizsettings->set('requiresafeexambrowser', settings_provider::USE_SEB_CLIENT_CONFIG);
         $quizsettings->save();
-        $this->assertNotContains($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
-        $this->assertNotContains($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
+        $this->assertStringNotContainsString($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
+        $this->assertStringNotContainsString($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
     }
 
     /**
@@ -1056,20 +1056,20 @@ class quizaccess_seb_rule__testcase extends advanced_testcase {
         $method->setAccessible(true);
 
         set_config('showseblinks', 'seb,http', 'quizaccess_seb');
-        $this->assertContains($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
-        $this->assertContains($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
+        $this->assertStringContainsString($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
+        $this->assertStringContainsString($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
 
         set_config('showseblinks', 'http', 'quizaccess_seb');
-        $this->assertNotContains($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
-        $this->assertContains($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
+        $this->assertStringNotContainsString($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
+        $this->assertStringContainsString($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
 
         set_config('showseblinks', 'seb', 'quizaccess_seb');
-        $this->assertContains($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
-        $this->assertNotContains($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
+        $this->assertStringContainsString($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
+        $this->assertStringNotContainsString($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
 
         set_config('showseblinks', '', 'quizaccess_seb');
-        $this->assertNotContains($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
-        $this->assertNotContains($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
+        $this->assertStringNotContainsString($this->get_seb_launch_link(), $method->invoke($this->make_rule()));
+        $this->assertStringNotContainsString($this->get_seb_config_download_link(), $method->invoke($this->make_rule()));
     }
 
     /**
@@ -1090,7 +1090,7 @@ class quizaccess_seb_rule__testcase extends advanced_testcase {
         $method->setAccessible(true);
 
         $button = $method->invoke($this->make_rule());
-        $this->assertContains("http://test.quit.link", $button);
+        $this->assertStringContainsString("http://test.quit.link", $button);
     }
 
     /**
@@ -1120,7 +1120,7 @@ class quizaccess_seb_rule__testcase extends advanced_testcase {
         $this->assertEquals($description[0], get_string('sebrequired', 'quizaccess_seb'));
 
         // The button is contained in the description when a quiz attempt is finished.
-        $this->assertContains("http://test.quit.link", $description[1]);
+        $this->assertStringContainsString("http://test.quit.link", $description[1]);
     }
 
     /**
@@ -1149,7 +1149,7 @@ class quizaccess_seb_rule__testcase extends advanced_testcase {
         $description = $this->make_rule()->description();
         $this->assertCount(3, $description);
         $this->assertEquals($description[0], get_string('sebrequired', 'quizaccess_seb'));
-        $this->assertContains($this->get_seb_config_download_link(), $description[1]);
+        $this->assertStringContainsString($this->get_seb_config_download_link(), $description[1]);
 
         // Can't see download config link as usage method doesn't have SEB config to download.
         $quizsettings->set('requiresafeexambrowser', settings_provider::USE_SEB_CLIENT_CONFIG);
index 20a632a..8f58e72 100644 (file)
@@ -207,11 +207,11 @@ class quiz_overview_report_testcase extends advanced_testcase {
 
         // Check the calculation of averages.
         $averagerow = $table->compute_average_row('overallaverage', $studentsjoins);
-        $this->assertContains('75.00', $averagerow['sumgrades']);
-        $this->assertContains('75.00', $averagerow['qsgrade1']);
+        $this->assertStringContainsString('75.00', $averagerow['sumgrades']);
+        $this->assertStringContainsString('75.00', $averagerow['qsgrade1']);
         if (!$isdownloading) {
-            $this->assertContains('(2)', $averagerow['sumgrades']);
-            $this->assertContains('(2)', $averagerow['qsgrade1']);
+            $this->assertStringContainsString('(2)', $averagerow['sumgrades']);
+            $this->assertStringContainsString('(2)', $averagerow['qsgrade1']);
         }
 
         // Ensure that filtering by initial does not break it.
index a0c6ef8..2f99a2b 100644 (file)
@@ -67,7 +67,7 @@ class quiz_question_bank_view_testcase extends advanced_testcase {
         $html = ob_get_clean();
 
         // Verify the output includes the expected question.
-        $this->assertContains('Example question', $html);
+        $this->assertStringContainsString('Example question', $html);
 
         // Verify the question has not been loaded into the cache.
         $this->assertFalse($cache->has($questiondata->id));
index 003eff0..7ad8bfb 100644 (file)
@@ -54,7 +54,7 @@ class mod_wiki_wikiparser_test extends basic_testcase {
             'link_callback_args' => ['swid' => 1],
         ]);
 
-        $this->assertContains($output, $parsingresult['parsed_text']);
+        $this->assertStringContainsString($output, $parsingresult['parsed_text']);
     }
 
     /**
index 39faa4c..c0135b3 100644 (file)
@@ -63,7 +63,7 @@ class workshopallocation_manual_privacy_provider_testcase extends \core_privacy\
         $prefs = writer::with_context(\context_system::instance())->get_user_preferences('workshopallocation_manual');
         $this->assertNotEmpty($prefs->workshopallocation_manual_perpage);
         $this->assertEquals(81, $prefs->workshopallocation_manual_perpage->value);
-        $this->assertContains(get_string('privacy:metadata:preference:perpage', 'workshopallocation_manual'),
+        $this->assertStringContainsString(get_string('privacy:metadata:preference:perpage', 'workshopallocation_manual'),
             $prefs->workshopallocation_manual_perpage->description);
     }
 }
index 7a39718..218e825 100644 (file)
@@ -70,7 +70,7 @@ class mod_workshop_cron_task_testcase extends advanced_testcase {
         ob_end_clean();
 
         // Assert that the phase has been switched.
-        $this->assertContains('Processing automatic assessment phase switch', $output);
+        $this->assertStringContainsString('Processing automatic assessment phase switch', $output);
         $this->assertEquals(workshop::PHASE_ASSESSMENT, $DB->get_field('workshop', 'phase', ['id' => $workshop->id]));
     }
 }
index cf9df9a..6db5be6 100644 (file)
@@ -66,7 +66,7 @@ class core_notes_generator_testcase extends advanced_testcase {
             $gen->create_instance(array('courseid' => 2));
             $this->fail('A note should not be allowed to be created without associcated userid');
         } catch (coding_exception $e) {
-            $this->assertContains('Module generator requires $record->userid', $e->getMessage());
+            $this->assertStringContainsString('Module generator requires $record->userid', $e->getMessage());
         }
 
         // Test not setting courseid.
@@ -74,7 +74,7 @@ class core_notes_generator_testcase extends advanced_testcase {
             $gen->create_instance(array('userid' => 2));
             $this->fail('A note should not be allowed to be created without associcated courseid');
         } catch (coding_exception $e) {
-            $this->assertContains('Module generator requires $record->courseid', $e->getMessage());
+            $this->assertStringContainsString('Module generator requires $record->courseid', $e->getMessage());
         }
     }
 
index 5fdff49..8e5654a 100644 (file)
@@ -85,20 +85,20 @@ class qbehaviour_deferredcbm_type_test extends qbehaviour_walkthrough_test_base
         $summarydata = $this->quba->get_summary_information(new question_display_options());
 
         // Verify.
-        $this->assertContains(get_string('breakdownbycertainty', 'qbehaviour_deferredcbm'),
+        $this->assertStringContainsString(get_string('breakdownbycertainty', 'qbehaviour_deferredcbm'),
                 $summarydata['qbehaviour_cbm_judgement_heading']['content']);
 
-        $this->assertContains('100%',
+        $this->assertStringContainsString('100%',
                 $summarydata['qbehaviour_cbm_judgement3']['content']);
-        $this->assertContains(get_string('judgementok', 'qbehaviour_deferredcbm'),
+        $this->assertStringContainsString(get_string('judgementok', 'qbehaviour_deferredcbm'),
                 $summarydata['qbehaviour_cbm_judgement3']['content']);
 
-        $this->assertContains('50%',
+        $this->assertStringContainsString('50%',
                 $summarydata['qbehaviour_cbm_judgement2']['content']);
-        $this->assertContains(get_string('slightlyoverconfident', 'qbehaviour_deferredcbm'),
+        $this->assertStringContainsString(get_string('slightlyoverconfident', 'qbehaviour_deferredcbm'),
                 $summarydata['qbehaviour_cbm_judgement2']['content']);
 
-        $this->assertContains(get_string('noquestions', 'qbehaviour_deferredcbm'),
+        $this->assertStringContainsString(get_string('noquestions', 'qbehaviour_deferredcbm'),
                 $summarydata['qbehaviour_cbm_judgement1']['content']);
     }
 
@@ -121,20 +121,20 @@ class qbehaviour_deferredcbm_type_test extends qbehaviour_walkthrough_test_base
         $summarydata = $this->quba->get_summary_information(new question_display_options());
 
         // Verify.
-        $this->assertContains(get_string('breakdownbycertainty', 'qbehaviour_deferredcbm'),
+        $this->assertStringContainsString(get_string('breakdownbycertainty', 'qbehaviour_deferredcbm'),
                 $summarydata['qbehaviour_cbm_judgement_heading']['content']);
 
-        $this->assertContains('100%',
+        $this->assertStringContainsString('100%',
                 $summarydata['qbehaviour_cbm_judgement3']['content']);
-        $this->assertContains(get_string('judgementok', 'qbehaviour_deferredcbm'),
+        $this->assertStringContainsString(get_string('judgementok', 'qbehaviour_deferredcbm'),
                 $summarydata['qbehaviour_cbm_judgement3']['content']);
 
-        $this->assertContains('50%',
+        $this->assertStringContainsString('50%',
                 $summarydata['qbehaviour_cbm_judgement2']['content']);
-        $this->assertContains(get_string('slightlyoverconfident', 'qbehaviour_deferredcbm'),
+        $this->assertStringContainsString(get_string('slightlyoverconfident', 'qbehaviour_deferredcbm'),
                 $summarydata['qbehaviour_cbm_judgement2']['content']);
 
-        $this->assertContains(get_string('noquestions', 'qbehaviour_deferredcbm'),
+        $this->assertStringContainsString(get_string('noquestions', 'qbehaviour_deferredcbm'),
                 $summarydata['qbehaviour_cbm_judgement1']['content']);
     }
 
index df59c5e..733efd7 100644 (file)
@@ -974,13 +974,13 @@ abstract class qbehaviour_walkthrough_test_base extends question_testcase {
 
     protected function check_output_contains($string) {
         $this->render();
-        $this->assertContains($string, $this->currentoutput,
+        $this->assertStringContainsString($string, $this->currentoutput,
                 'Expected string ' . $string . ' not found in ' . $this->currentoutput);
     }
 
     protected function check_output_does_not_contain($string) {
         $this->render();
-        $this->assertNotContains($string, $this->currentoutput,
+        $this->assertStringNotContainsString($string, $this->currentoutput,
                 'String ' . $string . ' unexpectedly found in ' . $this->currentoutput);
     }
 
index 6f1408d..7f5d2bc 100644 (file)
@@ -52,12 +52,12 @@ class aikenformat_test extends question_testcase {
         ob_end_clean();
 
         // Check that there were some expected errors.
-        $this->assertContains('Error importing question A question with too few answers', $output);
-        $this->assertContains('Question must have at least 2 answers on line 3', $output);
-        $this->assertContains('Question not started on line 5', $output);
-        $this->assertContains('Question not started on line 7', $output);
-        $this->assertContains('Error importing question A question started but not finished', $output);
-        $this->assertContains('Question not completed before next question start on line 18', $output);
+        $this->assertStringContainsString('Error importing question A question with too few answers', $output);
+        $this->assertStringContainsString('Question must have at least 2 answers on line 3', $output);
+        $this->assertStringContainsString('Question not started on line 5', $output);
+        $this->assertStringContainsString('Question not started on line 7', $output);
+        $this->assertStringContainsString('Error importing question A question started but not finished', $output);
+        $this->assertStringContainsString('Question not completed before next question start on line 18', $output);
 
         // There are two expected questions.
         $this->assertCount(2, $questions);
index 13aae67..d32ecad 100644 (file)
@@ -87,9 +87,9 @@ The capital of France is {#5}.
         ob_end_clean();
 
         // Check that there were some expected errors.
-        $this->assertContains('Error importing question', $output);
-        $this->assertContains('Invalid embedded answers (Cloze) question', $output);
-        $this->assertContains('This type of question requires at least 2 choices', $output);
+        $this->assertStringContainsString('Error importing question', $output);
+        $this->assertStringContainsString('Invalid embedded answers (Cloze) question', $output);
+        $this->assertStringContainsString('This type of question requires at least 2 choices', $output);
 
         // No question  have been imported.
         $this->assertCount(0, $questions);
@@ -106,9 +106,9 @@ The capital of France is {#5}.
         ob_end_clean();
 
         // Check that there were some expected errors.
-        $this->assertContains('Error importing question', $output);
-        $this->assertContains('Invalid embedded answers (Cloze) question', $output);
-        $this->assertContains('One of the answers should have a score of 100% so it is possible to get full marks for this question.',
+        $this->assertStringContainsString('Error importing question', $output);
+        $this->assertStringContainsString('Invalid embedded answers (Cloze) question', $output);
+        $this->assertStringContainsString('One of the answers should have a score of 100% so it is possible to get full marks for this question.',
                 $output);
 
         // No question  have been imported.
@@ -126,9 +126,9 @@ The capital of France is {#5}.
         ob_end_clean();
 
         // Check that there were some expected errors.
-        $this->assertContains('Error importing question', $output);
-        $this->assertContains('Invalid embedded answers (Cloze) question', $output);
-        $this->assertContains('The answer must be a number, for example -1.234 or 3e8, or \'*\'.', $output);
+        $this->assertStringContainsString('Error importing question', $output);
+        $this->assertStringContainsString('Invalid embedded answers (Cloze) question', $output);
+        $this->assertStringContainsString('The answer must be a number, for example -1.234 or 3e8, or \'*\'.', $output);
 
         // No question  have been imported.
         $this->assertCount(0, $questions);
@@ -145,9 +145,9 @@ The capital of France is {#5}.
         ob_end_clean();
 
         // Check that there were some expected errors.
-        $this->assertContains('Error importing question', $output);
-        $this->assertContains('Invalid embedded answers (Cloze) question', $output);
-        $this->assertContains('The question text must include at least one embedded answer.', $output);
+        $this->assertStringContainsString('Error importing question', $output);
+        $this->assertStringContainsString('Invalid embedded answers (Cloze) question', $output);
+        $this->assertStringContainsString('The question text must include at least one embedded answer.', $output);
 
         // No question  have been imported.
         $this->assertCount(0, $questions);
index ebd9fcd..0428240 100644 (file)
@@ -478,13 +478,13 @@ class qformat_xml_import_export_test extends advanced_testcase {
         ob_end_clean();
 
         // Check that there were some expected errors.
-        $this->assertContains('Error importing question', $output);
-        $this->assertContains('Invalid embedded answers (Cloze) question', $output);
-        $this->assertContains('This type of question requires at least 2 choices', $output);
-        $this->assertContains('The answer must be a number, for example -1.234 or 3e8, or \'*\'.', $output);
-        $this->assertContains('One of the answers should have a score of 100% so it is possible to get full marks for this question.',
+        $this->assertStringContainsString('Error importing question', $output);
+        $this->assertStringContainsString('Invalid embedded answers (Cloze) question', $output);
+        $this->assertStringContainsString('This type of question requires at least 2 choices', $output);
+        $this->assertStringContainsString('The answer must be a number, for example -1.234 or 3e8, or \'*\'.', $output);
+        $this->assertStringContainsString('One of the answers should have a score of 100% so it is possible to get full marks for this question.',
                 $output);
-        $this->assertContains('The question text must include at least one embedded answer.', $output);
+        $this->assertStringContainsString('The question text must include at least one embedded answer.', $output);
 
         // No question  have been imported.
         $this->assertCount(0, $questions);
index e2c77fa..9108d70 100644 (file)
@@ -65,7 +65,7 @@ class core_question_bank_view_testcase extends advanced_testcase {
         $html = ob_get_clean();
 
         // Verify the output includes the expected question.
-        $this->assertContains('Example question', $html);
+        $this->assertStringContainsString('Example question', $html);
 
         // Verify the question has not been loaded into the cache.
         $this->assertFalse($cache->has($questiondata->id));
@@ -99,6 +99,6 @@ class core_question_bank_view_testcase extends advanced_testcase {
         // Mainly we are verifying that there was no fatal error.
 
         // Verify the output includes the expected question.
-        $this->assertContains('Example question', $html);
+        $this->assertStringContainsString('Example question', $html);
     }
 }
index a263a6f..4d4b958 100644 (file)
@@ -67,8 +67,8 @@ class question_bank_column_testcase extends advanced_testcase {
         $columnbase->display_header();
         $output = ob_get_clean();
 
-        $this->assertContains(' title="Sort by Apple ascending">Apple</a>', $output);
-        $this->assertContains(' title="Sort by Banana ascending">Banana</a>', $output);
+        $this->assertStringContainsString(' title="Sort by Apple ascending">Apple</a>', $output);
+        $this->assertStringContainsString(' title="Sort by Banana ascending">Banana</a>', $output);
     }
 
     /**
@@ -103,7 +103,7 @@ class question_bank_column_testcase extends advanced_testcase {
         $columnbase->display_header();
         $output = ob_get_clean();
 
-        $this->assertContains(' title="Sort by Apple Tooltips ascending">Apple</a>', $output);
-        $this->assertContains(' title="Sort by Banana Tooltips ascending">Banana</a>', $output);
+        $this->assertStringContainsString(' title="Sort by Apple Tooltips ascending">Apple</a>', $output);
+        $this->assertStringContainsString(' title="Sort by Banana Tooltips ascending">Banana</a>', $output);
     }
 }
index a1a9bb9..400006a 100644 (file)
@@ -499,7 +499,7 @@ class qtype_essay_walkthrough_testcase extends qbehaviour_walkthrough_test_base
         // Test taht no HTML comment has been added to the response.
         $this->assertRegExp('/Once upon a time there was a frog called Freddy. He lived happily ever after.(?!&lt;!--)/', $this->currentoutput);
         // Test for the hash of an empty file area.
-        $this->assertNotContains('d41d8cd98f00b204e9800998ecf8427e', $this->currentoutput);
+        $this->assertStringNotContainsString('d41d8cd98f00b204e9800998ecf8427e', $this->currentoutput);
     }
 
     public function test_deferred_feedback_html_editor_with_files_attempt_wrong_filetypes() {
index 8c9f491..96621eb 100644 (file)
@@ -1161,7 +1161,7 @@ class search_solr_engine_testcase extends advanced_testcase {
         $this->assertCount(2, $orders);
         $this->assertArrayHasKey('relevance', $orders);
         $this->assertArrayHasKey('location', $orders);
-        $this->assertContains('Course: Frogs', $orders['location']);
+        $this->assertStringContainsString('Course: Frogs', $orders['location']);
 
         // Test with activity context.
         $page = $generator->create_module('page', ['course' => $course->id, 'name' => 'Toads']);
@@ -1170,7 +1170,7 @@ class search_solr_engine_testcase extends advanced_testcase {
         $this->assertCount(2, $orders);
         $this->assertArrayHasKey('relevance', $orders);
         $this->assertArrayHasKey('location', $orders);
-        $this->assertContains('Page: Toads', $orders['location']);
+        $this->assertStringContainsString('Page: Toads', $orders['location']);
 
         // Test with block context.
         $instance = (object)['blockname' => 'html', 'parentcontextid' => $coursecontext->id,
@@ -1184,7 +1184,7 @@ class search_solr_engine_testcase extends advanced_testcase {
         $this->assertCount(2, $orders);
         $this->assertArrayHasKey('relevance', $orders);
         $this->assertArrayHasKey('location', $orders);
-        $this->assertContains('Block: HTML', $orders['location']);
+        $this->assertStringContainsString('Block: HTML', $orders['location']);
     }
 
     /**
index 8f0a514..a78a2c2 100644 (file)
@@ -61,7 +61,7 @@ class external_testcase extends \advanced_testcase {
         // Check that the result contains all the expected fields.
         $this->assertEquals($student1->id, $result[0]->id);
         $this->assertEquals('Amelia Aardvark', $result[0]->fullname);
-        $this->assertContains('/u/f2', $result[0]->profileimageurlsmall);
+        $this->assertStringContainsString('/u/f2', $result[0]->profileimageurlsmall);
 
         // Check we aren't leaking information about user email address (for instance).
         $this->assertObjectNotHasAttribute('email', $result[0]);
index 27ed476..0a52f5f 100644 (file)
@@ -155,7 +155,7 @@ class search_manager_testcase extends advanced_testcase {
             $search->reset_config($fakeareaid);
             $this->fail('An exception should be triggered if the provided search area does not exist.');
         } catch (moodle_exception $ex) {
-            $this->assertContains($fakeareaid . ' search area is not available.', $ex->getMessage());
+            $this->assertStringContainsString($fakeareaid . ' search area is not available.', $ex->getMessage());
         }
 
         // We clean it all but enabled components.
@@ -343,18 +343,18 @@ class search_manager_testcase extends advanced_testcase {
         $progress->reset_buffer();
 
         // Check for the standard text.
-        $this->assertContains('Processing area: Mock search area', $out);
-        $this->assertContains('Stopping indexing due to time limit', $out);
+        $this->assertStringContainsString('Processing area: Mock search area', $out);
+        $this->assertStringContainsString('Stopping indexing due to time limit', $out);
 
         // Check for initial query performance indication.
-        $this->assertContains('Initial query took 10.1 seconds.', $out);
+        $this->assertStringContainsString('Initial query took 10.1 seconds.', $out);
 
         // Check for the two (approximately) every-30-seconds messages.
-        $this->assertContains('01:00:41: Done to 1/11/17, 01:01', $out);
-        $this->assertContains('01:01:13: Done to 1/11/17, 01:03', $out);
+        $this->assertStringContainsString('01:00:41: Done to 1/11/17, 01:01', $out);
+        $this->assertStringContainsString('01:01:13: Done to 1/11/17, 01:03', $out);
 
         // Check for the 'not complete' indicator showing when it was done until.
-        $this->assertContains('Processed 5 records containing 5 documents, in 89.1 seconds ' .
+        $this->assertStringContainsString('Processed 5 records containing 5 documents, in 89.1 seconds ' .
                 '(not complete; done to 1/11/17, 01:04)', $out);
 
         // Make the initial query delay less than 5 seconds, so it won't appear. Make the documents
@@ -368,11 +368,11 @@ class search_manager_testcase extends advanced_testcase {
         $out = $progress->get_buffer();
         $progress->reset_buffer();
 
-        $this->assertContains('Processing area: Mock search area', $out);
-        $this->assertContains('Stopping indexing due to time limit', $out);
-        $this->assertNotContains('Initial query took', $out);
-        $this->assertNotContains(': Done to', $out);
-        $this->assertContains('Processed 2 records containing 2 documents, in 6.9 seconds ' .
+        $this->assertStringContainsString('Processing area: Mock search area', $out);
+        $this->assertStringContainsString('Stopping indexing due to time limit', $out);
+        $this->assertStringNotContainsString('Initial query took', $out);
+        $this->assertStringNotContainsString(': Done to', $out);
+        $this->assertStringContainsString('Processed 2 records containing 2 documents, in 6.9 seconds ' .
                 '(not complete; done to 1/11/17, 01:05).', $out);
 
         // Run the remaining items to complete it.
@@ -381,11 +381,11 @@ class search_manager_testcase extends advanced_testcase {
         $out = $progress->get_buffer();
         $progress->reset_buffer();
 
-        $this->assertContains('Processing area: Mock search area', $out);
-        $this->assertNotContains('Stopping indexing due to time limit', $out);
-        $this->assertNotContains('Initial query took', $out);
-        $this->assertNotContains(': Done to', $out);
-        $this->assertContains('Processed 3 records containing 3 documents, in 7.9 seconds.', $out);
+        $this->assertStringContainsString('Processing area: Mock search area', $out);
+        $this->assertStringNotContainsString('Stopping indexing due to time limit', $out);
+        $this->assertStringNotContainsString('Initial query took', $out);
+        $this->assertStringNotContainsString(': Done to', $out);
+        $this->assertStringContainsString('Processed 3 records containing 3 documents, in 7.9 seconds.', $out);
 
         $searchgenerator->tearDown();
     }
@@ -1161,14 +1161,14 @@ class search_manager_testcase extends advanced_testcase {
         $progress->reset_buffer();
 
         // Check that it's done both areas.
-        $this->assertContains(
+        $this->assertStringContainsString(
                 'Indexing requested context: Course: TCourse (search area: mod_label-activity)',
                 $out);
-        $this->assertContains(
+        $this->assertStringContainsString(
                 'Completed requested context: Course: TCourse (search area: mod_label-activity)',
                 $out);
-        $this->assertContains('Indexing requested context: Forum: TForum1', $out);
-        $this->assertContains('Completed requested context: Forum: TForum1', $out);
+        $this->assertStringContainsString('Indexing requested context: Forum: TForum1', $out);
+        $this->assertStringContainsString('Completed requested context: Forum: TForum1', $out);
 
         // Check the requests database table is now empty.
         $this->assertEquals(0, $DB->count_records('search_index_requests'));
@@ -1187,11 +1187,11 @@ class search_manager_testcase extends advanced_testcase {
         $progress->reset_buffer();
 
         // Confirm the right wrapper information was logged.
-        $this->assertContains(
+        $this->assertStringContainsString(
                 'Indexing requested context: Course: TCourse (search area: mod_forum-activity)',
                 $out);
-        $this->assertContains('Stopping indexing due to time limit', $out);
-        $this->assertContains(
+        $this->assertStringContainsString('Stopping indexing due to time limit', $out);
+        $this->assertStringContainsString(
                 'Ending requested context: Course: TCourse (search area: mod_forum-activity)',
                 $out);
 
@@ -1204,10 +1204,10 @@ class search_manager_testcase extends advanced_testcase {
         $search->process_index_requests(2.0, $progress);
         $out = $progress->get_buffer();
         $progress->reset_buffer();
-        $this->assertContains(
+        $this->assertStringContainsString(
                 'Completed requested context: Course: TCourse (search area: mod_forum-activity)',
                 $out);
-        $this->assertContains(
+        $this->assertStringContainsString(
                 'Completed requested context: Course: TCourse (search area: mod_forum-post)',
                 $out);
 
@@ -1225,13 +1225,13 @@ class search_manager_testcase extends advanced_testcase {
         $search->process_index_requests(0.1, $progress);
         $out = $progress->get_buffer();
         $progress->reset_buffer();
-        $this->assertContains(
+        $this->assertStringContainsString(
                 'Completed requested context: Forum: TForum2 (search area: mod_forum-activity)',
                 $out);
         $search->process_index_requests(0.1, $progress);
         $out = $progress->get_buffer();
         $progress->reset_buffer();
-        $this->assertContains(
+        $this->assertStringContainsString(
                 'Completed requested context: Forum: TForum1 (search area: mod_forum-activity)',
                 $out);
 
@@ -1249,7 +1249,7 @@ class search_manager_testcase extends advanced_testcase {
         $search->process_index_requests(10, $progress);
         $out = $progress->get_buffer();
         $progress->reset_buffer();
-        $this->assertContains('Skipped deleted context: ' . $context->id, $out);
+        $this->assertStringContainsString('Skipped deleted context: ' . $context->id, $out);
 
         // Confirm request table is now empty.
         $this->assertEquals(0, $DB->count_records('search_index_requests'));
index 71de534..2e179df 100644 (file)
@@ -1218,9 +1218,9 @@ class core_user_externallib_testcase extends externallib_advanced_testcase {
         $result = external_api::clean_returnvalue(core_user_external::update_picture_returns(), $result);
         $picture = $DB->get_field('user', 'picture', array('id' => $user->id));
         // The new revision is in the url for the user.
-        $this->assertContains($picture, $result['profileimageurl']);
+        $this->assertStringContainsString($picture, $result['profileimageurl']);
         // Check expected URL for serving the image.
-        $this->assertContains("/$contextid/user/icon", $result['profileimageurl']);
+        $this->assertStringContainsString("/$contextid/user/icon", $result['profileimageurl']);
 
         // Delete image.
         $result = core_user_external::update_picture(0, true);
@@ -1241,8 +1241,8 @@ class core_user_externallib_testcase extends externallib_advanced_testcase {
         $result = external_api::clean_returnvalue(core_user_external::update_picture_returns(), $result);
         // The new revision is in the url for the user.
         $picture = $DB->get_field('user', 'picture', array('id' => $user->id));
-        $this->assertContains($picture, $result['profileimageurl']);
-        $this->assertContains("/$contextid/user/icon", $result['profileimageurl']);
+        $this->assertStringContainsString($picture, $result['profileimageurl']);
+        $this->assertStringContainsString("/$contextid/user/icon", $result['profileimageurl']);
     }
 
     /**
index 6cd62cb..4224fae 100644 (file)
@@ -77,8 +77,8 @@ class userroleseditable_testcase extends advanced_testcase {
         $this->assertTrue($result instanceof \core_user\output\user_roles_editable);
         $currentroles = get_user_roles_in_course($user2->id, $course1->id);
 
-        $this->assertContains('Non-editing teacher', $currentroles);
-        $this->assertContains('Student', $currentroles);
+        $this->assertStringContainsString('Non-editing teacher', $currentroles);
+        $this->assertStringContainsString('Student', $currentroles);
 
     }