Merge branch 'MDL-67673' of https://github.com/stronk7/moodle into master
This commit is contained in:
@@ -33,6 +33,7 @@ CVS
|
||||
/.project
|
||||
/.buildpath
|
||||
/.cache
|
||||
.phpunit.result.cache
|
||||
phpunit.xml
|
||||
# Composer support. Do not ignore composer.json, or composer.lock. These should be shipped by us.
|
||||
composer.phar
|
||||
|
||||
@@ -536,7 +536,7 @@ class core_role_privacy_testcase extends provider_testcase {
|
||||
$user1->id,
|
||||
$admin->id
|
||||
];
|
||||
$this->assertEquals($expected, $userlist2->get_userids(), '', 0.0, 10, true);
|
||||
$this->assertEqualsCanonicalizing($expected, $userlist2->get_userids());
|
||||
|
||||
// The user list for coursecontext1 should user1, user2 and admin (role creator).
|
||||
$userlist3 = new \core_privacy\local\request\userlist($coursecontext1, $component);
|
||||
@@ -547,7 +547,7 @@ class core_role_privacy_testcase extends provider_testcase {
|
||||
$user2->id,
|
||||
$admin->id
|
||||
];
|
||||
$this->assertEquals($expected, $userlist3->get_userids(), '', 0.0, 10, true);
|
||||
$this->assertEqualsCanonicalizing($expected, $userlist3->get_userids());
|
||||
|
||||
// The user list for coursecatcontext should user2 and admin (role creator).
|
||||
$userlist4 = new \core_privacy\local\request\userlist($coursecatcontext, $component);
|
||||
@@ -557,7 +557,7 @@ class core_role_privacy_testcase extends provider_testcase {
|
||||
$user2->id,
|
||||
$admin->id
|
||||
];
|
||||
$this->assertEquals($expected, $userlist4->get_userids(), '', 0.0, 10, true);
|
||||
$this->assertEqualsCanonicalizing($expected, $userlist4->get_userids());
|
||||
|
||||
// The user list for systemcontext should user1 and admin (role creator).
|
||||
$userlist6 = new \core_privacy\local\request\userlist($systemcontext, $component);
|
||||
@@ -567,7 +567,7 @@ class core_role_privacy_testcase extends provider_testcase {
|
||||
$user1->id,
|
||||
$admin->id
|
||||
];
|
||||
$this->assertEquals($expected, $userlist6->get_userids(), '', 0.0, 10, true);
|
||||
$this->assertEqualsCanonicalizing($expected, $userlist6->get_userids());
|
||||
|
||||
// The user list for cmcontext should user1, user2 and admin (role creator).
|
||||
$userlist7 = new \core_privacy\local\request\userlist($cmcontext, $component);
|
||||
@@ -578,7 +578,7 @@ class core_role_privacy_testcase extends provider_testcase {
|
||||
$user2->id,
|
||||
$admin->id
|
||||
];
|
||||
$this->assertEquals($expected, $userlist7->get_userids(), '', 0.0, 10, true);
|
||||
$this->assertEqualsCanonicalizing($expected, $userlist7->get_userids());
|
||||
|
||||
// The user list for blockcontext should user1 and admin (role creator).
|
||||
$userlist8 = new \core_privacy\local\request\userlist($blockcontext, $component);
|
||||
@@ -588,7 +588,7 @@ class core_role_privacy_testcase extends provider_testcase {
|
||||
$user1->id,
|
||||
$admin->id
|
||||
];
|
||||
$this->assertEquals($expected, $userlist8->get_userids(), '', 0.0, 10, true);
|
||||
$this->assertEqualsCanonicalizing($expected, $userlist8->get_userids());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -744,4 +744,4 @@ class core_role_privacy_testcase extends provider_testcase {
|
||||
}
|
||||
return $rolesnames;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +66,6 @@ class tool_analytics_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
/**
|
||||
* test_potential_contexts description
|
||||
*
|
||||
* @expectedException required_capability_exception
|
||||
*/
|
||||
public function test_potential_contexts_no_manager() {
|
||||
$this->resetAfterTest();
|
||||
@@ -75,6 +73,7 @@ class tool_analytics_external_testcase extends externallib_advanced_testcase {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->assertCount(2, \tool_analytics\external::potential_contexts());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Setup test.
|
||||
*/
|
||||
public function setup() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class tool_capability_events_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Setup testcase.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->setAdminUser();
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Setup function- we will create a course and add an assign instance to it.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
// Create some users.
|
||||
@@ -60,9 +60,6 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
cohort_add_member($this->cohort->id, $this->userassignover->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException required_capability_exception
|
||||
*/
|
||||
public function test_create_cohort_role_assignment_without_permission() {
|
||||
$this->setUser($this->userassignto);
|
||||
$params = (object) array(
|
||||
@@ -70,12 +67,10 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
'roleid' => $this->roleid,
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
api::create_cohort_role_assignment($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException core_competency\invalid_persistent_exception
|
||||
*/
|
||||
public function test_create_cohort_role_assignment_with_invalid_data() {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
@@ -83,6 +78,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
'roleid' => -8,
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$this->expectException(\core_competency\invalid_persistent_exception::class);
|
||||
api::create_cohort_role_assignment($params);
|
||||
}
|
||||
|
||||
@@ -100,9 +96,6 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
$this->assertEquals($result->get('cohortid'), $this->cohort->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException required_capability_exception
|
||||
*/
|
||||
public function test_delete_cohort_role_assignment_without_permission() {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
@@ -112,12 +105,10 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
);
|
||||
$result = api::create_cohort_role_assignment($params);
|
||||
$this->setUser($this->userassignto);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
api::delete_cohort_role_assignment($result->get('id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException dml_missing_record_exception
|
||||
*/
|
||||
public function test_delete_cohort_role_assignment_with_invalid_data() {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
@@ -126,6 +117,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$result = api::create_cohort_role_assignment($params);
|
||||
$this->expectException(dml_missing_record_exception::class);
|
||||
api::delete_cohort_role_assignment($result->get('id') + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
|
||||
/**
|
||||
* Overriding setUp() function to always reset after tests.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
|
||||
CONTEXT_COURSECAT
|
||||
];
|
||||
// Test the User's contexts equal the system and course category context.
|
||||
$this->assertEquals($expected, $contextlevels, '', 0, 10, true);
|
||||
$this->assertEqualsCanonicalizing($expected, $contextlevels);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@ class tool_dataprivacy_expired_data_requests_testcase extends data_privacy_testc
|
||||
/**
|
||||
* Test tearDown.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
\core_privacy\local\request\writer::reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class tool_dataprivacy_manager_observer_testcase extends data_privacy_testcase {
|
||||
return $message->useridto;
|
||||
}, $messages);
|
||||
|
||||
$this->assertEquals(array_keys($dpos), $messageusers, '', 0.0, 0, true);
|
||||
$this->assertEqualsCanonicalizing(array_keys($dpos), $messageusers);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class tool_dataprivacy_task_testcase extends data_privacy_testcase {
|
||||
/**
|
||||
* Test tearDown.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
\core_privacy\local\request\writer::reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class tool_installaddon_installer_testcase extends advanced_testcase {
|
||||
$this->assertEquals(1, preg_match('~^site=(.+)$~', $query, $matches));
|
||||
$site = rawurldecode($matches[1]);
|
||||
$site = json_decode(base64_decode($site), true);
|
||||
$this->assertInternalType('array', $site);
|
||||
$this->assertIsArray($site);
|
||||
$this->assertEquals(3, count($site));
|
||||
$this->assertSame('Nasty site', $site['fullname']);
|
||||
$this->assertSame('file:///etc/passwd', $site['url']);
|
||||
|
||||
@@ -36,7 +36,7 @@ class tool_langimport_events_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Setup testcase.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->setAdminUser();
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
@@ -56,12 +56,10 @@ class tool_langimport_events_testcase extends advanced_testcase {
|
||||
$this->assertEquals(context_system::instance(), $event->get_context());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException coding_exception
|
||||
* @expectedExceptionMessage The 'langcode' value must be set to a valid language code
|
||||
*/
|
||||
public function test_langpack_updated_validation() {
|
||||
|
||||
$this->expectException('coding_exception');
|
||||
$this->expectExceptionMessage("The 'langcode' value must be set to a valid language code");
|
||||
\tool_langimport\event\langpack_updated::event_with_langcode('broken langcode');
|
||||
}
|
||||
|
||||
@@ -78,12 +76,10 @@ class tool_langimport_events_testcase extends advanced_testcase {
|
||||
$this->assertEquals(context_system::instance(), $event->get_context());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException coding_exception
|
||||
* @expectedExceptionMessage The 'langcode' value must be set to a valid language code
|
||||
*/
|
||||
public function test_langpack_installed_validation() {
|
||||
|
||||
$this->expectException('coding_exception');
|
||||
$this->expectExceptionMessage("The 'langcode' value must be set to a valid language code");
|
||||
\tool_langimport\event\langpack_imported::event_with_langcode('broken langcode');
|
||||
}
|
||||
|
||||
@@ -100,12 +96,10 @@ class tool_langimport_events_testcase extends advanced_testcase {
|
||||
$this->assertEquals(context_system::instance(), $event->get_context());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException coding_exception
|
||||
* @expectedExceptionMessage The 'langcode' value must be set to a valid language code
|
||||
*/
|
||||
public function test_langpack_removed_validation() {
|
||||
|
||||
$this->expectException('coding_exception');
|
||||
$this->expectExceptionMessage("The 'langcode' value must be set to a valid language code");
|
||||
\tool_langimport\event\langpack_removed::event_with_langcode('broken langcode');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ require_once(__DIR__ . '/fixtures/event.php');
|
||||
*/
|
||||
class logstore_database_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
$this->preventResetByRollback(); // Logging waits till the transaction gets committed.
|
||||
|
||||
@@ -48,7 +48,7 @@ require_once(__DIR__ . '/fixtures/event.php');
|
||||
*/
|
||||
class logstore_legacy_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ require_once(__DIR__ . '/fixtures/event.php');
|
||||
*/
|
||||
class logstore_standard_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->preventResetByRollback(); // Logging waits till the transaction gets committed.
|
||||
}
|
||||
|
||||
@@ -540,7 +540,7 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Reset any garbage collector changes to the previous state at the end of the test.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
if ($this->wedisabledgc) {
|
||||
gc_enable();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class tool_log_manager_testcase extends advanced_testcase {
|
||||
$this->assertInstanceOf('core\log\manager', $manager);
|
||||
|
||||
$stores = $manager->get_readers();
|
||||
$this->assertInternalType('array', $stores);
|
||||
$this->assertIsArray($stores);
|
||||
$this->assertCount(0, $stores);
|
||||
|
||||
$this->assertFileExists("$CFG->dirroot/$CFG->admin/tool/log/store/standard/version.php");
|
||||
@@ -44,27 +44,27 @@ class tool_log_manager_testcase extends advanced_testcase {
|
||||
$this->assertInstanceOf('core\log\manager', $manager);
|
||||
|
||||
$stores = $manager->get_readers();
|
||||
$this->assertInternalType('array', $stores);
|
||||
$this->assertIsArray($stores);
|
||||
$this->assertCount(2, $stores);
|
||||
foreach ($stores as $key => $store) {
|
||||
$this->assertInternalType('string', $key);
|
||||
$this->assertIsString($key);
|
||||
$this->assertInstanceOf('core\log\sql_reader', $store);
|
||||
}
|
||||
|
||||
$stores = $manager->get_readers('core\log\sql_internal_table_reader');
|
||||
$this->assertInternalType('array', $stores);
|
||||
$this->assertIsArray($stores);
|
||||
$this->assertCount(1, $stores);
|
||||
foreach ($stores as $key => $store) {
|
||||
$this->assertInternalType('string', $key);
|
||||
$this->assertIsString($key);
|
||||
$this->assertSame('logstore_standard', $key);
|
||||
$this->assertInstanceOf('core\log\sql_internal_table_reader', $store);
|
||||
}
|
||||
|
||||
$stores = $manager->get_readers('core\log\sql_reader');
|
||||
$this->assertInternalType('array', $stores);
|
||||
$this->assertIsArray($stores);
|
||||
$this->assertCount(2, $stores);
|
||||
foreach ($stores as $key => $store) {
|
||||
$this->assertInternalType('string', $key);
|
||||
$this->assertIsString($key);
|
||||
$this->assertInstanceOf('core\log\sql_reader', $store);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ require_once($CFG->dirroot . '/admin/tool/log/store/standard/tests/fixtures/even
|
||||
*/
|
||||
class tool_log_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->preventResetByRollback(); // Logging waits till the transaction gets committed.
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Setup function- we will create a course and add an assign instance to it.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB, $CFG;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -46,7 +46,7 @@ class tool_lpmigrate_framework_processor_testcase extends advanced_testcase {
|
||||
* Then we create 2 courses, and in each 1 CM.
|
||||
* Then we attach some competencies from the first framework to courses and CM.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$dg = $this->getDataGenerator();
|
||||
$lpg = $dg->get_plugin_generator('core_competency');
|
||||
|
||||
@@ -44,7 +44,7 @@ use tool_messageinbound\privacy\provider;
|
||||
*/
|
||||
class tool_messageinbound_manager_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ use tool_messageinbound\privacy\provider;
|
||||
*/
|
||||
class tool_messageinbound_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,7 @@ class tool_mobile_privacy_testcase extends \core_privacy\tests\provider_testcase
|
||||
/**
|
||||
* Basic setup for these tests.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Set up method.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Enable monitor.
|
||||
set_config('enablemonitor', 1, 'tool_monitor');
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,7 +33,7 @@ class tool_monitor_events_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Tests set up.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
set_config('enablemonitor', 1, 'tool_monitor');
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class tool_monitor_generator_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Set up method.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Enable monitor.
|
||||
set_config('enablemonitor', 1, 'tool_monitor');
|
||||
}
|
||||
@@ -138,4 +138,4 @@ class tool_monitor_generator_testcase extends advanced_testcase {
|
||||
$this->assertEquals(1, $historydata->userid);
|
||||
$this->assertEquals(1, $historydata->sid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class tool_monitor_privacy_testcase extends provider_testcase {
|
||||
/**
|
||||
* Set up method.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
// Enable monitor.
|
||||
set_config('enablemonitor', 1, 'tool_monitor');
|
||||
|
||||
@@ -37,7 +37,7 @@ class tool_monitor_rule_manager_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Set up method.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Enable monitor.
|
||||
set_config('enablemonitor', 1, 'tool_monitor');
|
||||
}
|
||||
@@ -192,4 +192,4 @@ class tool_monitor_rule_manager_testcase extends advanced_testcase {
|
||||
$this->assertEmpty(array_diff(array_keys($ruledata), $ruleids));
|
||||
$this->assertCount(10, $ruledata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class tool_monitor_subscription_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Test set up.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
// Create the mock subscription.
|
||||
@@ -59,11 +59,10 @@ class tool_monitor_subscription_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test for the magic __get method.
|
||||
*
|
||||
* @expectedException coding_exception
|
||||
*/
|
||||
public function test_magic_get() {
|
||||
$this->assertEquals(20, $this->subscription->courseid);
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->subscription->ruleid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class tool_monitor_task_check_subscriptions_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Test set up.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
set_config('enablemonitor', 1, 'tool_monitor');
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -35,7 +35,7 @@ class tool_monitor_task_clean_events_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Test set up.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
set_config('enablemonitor', 1, 'tool_monitor');
|
||||
$this->resetAfterTest(true);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class tool_policy_external_testcase extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Setup function- we will create some policy docs.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class tool_policy_privacy_provider_testcase extends \core_privacy\tests\provider
|
||||
/**
|
||||
* Setup function. Will create a user.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
@@ -274,13 +274,9 @@ class tool_policy_privacy_provider_testcase extends \core_privacy\tests\provider
|
||||
// Request export for the manager.
|
||||
$contextlist = provider::get_contexts_for_userid($this->manager->id);
|
||||
$this->assertCount(3, $contextlist);
|
||||
$this->assertEquals(
|
||||
$this->assertEqualsCanonicalizing(
|
||||
[$managercontext->id, $usercontext->id, $systemcontext->id],
|
||||
$contextlist->get_contextids(),
|
||||
'',
|
||||
0.0,
|
||||
1,
|
||||
true
|
||||
$contextlist->get_contextids()
|
||||
);
|
||||
|
||||
$approvedcontextlist = new approved_contextlist($this->user, 'tool_policy', [$usercontext->id]);
|
||||
@@ -332,7 +328,7 @@ class tool_policy_privacy_provider_testcase extends \core_privacy\tests\provider
|
||||
// Agree to the policies for oneself.
|
||||
$contextlist = provider::get_contexts_for_userid($this->manager->id);
|
||||
$this->assertCount(2, $contextlist);
|
||||
$this->assertEquals([$managercontext->id, $systemcontext->id], $contextlist->get_contextids(), '', 0.0, 1, true);
|
||||
$this->assertEqualsCanonicalizing([$managercontext->id, $systemcontext->id], $contextlist->get_contextids());
|
||||
|
||||
$approvedcontextlist = new approved_contextlist($this->manager, 'tool_policy', $contextlist->get_contextids());
|
||||
provider::export_user_data($approvedcontextlist);
|
||||
|
||||
@@ -46,7 +46,7 @@ class tool_recyclebin_category_bin_tests extends advanced_testcase {
|
||||
/**
|
||||
* Setup for each test.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class tool_recyclebin_course_bin_tests extends advanced_testcase {
|
||||
/**
|
||||
* Setup for each test.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class tool_recyclebin_events_testcase extends advanced_testcase {
|
||||
*
|
||||
* This is executed before running any test in this file.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// We want the category and course bin to be enabled.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -35,21 +35,16 @@ global $CFG;
|
||||
*/
|
||||
class tool_uploadcourse_course_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* @expectedException coding_exception
|
||||
*/
|
||||
public function test_proceed_without_prepare() {
|
||||
$this->resetAfterTest(true);
|
||||
$mode = tool_uploadcourse_processor::MODE_CREATE_NEW;
|
||||
$updatemode = tool_uploadcourse_processor::UPDATE_NOTHING;
|
||||
$data = array();
|
||||
$co = new tool_uploadcourse_course($mode, $updatemode, $data);
|
||||
$this->expectException(coding_exception::class);
|
||||
$co->proceed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException moodle_exception
|
||||
*/
|
||||
public function test_proceed_when_prepare_failed() {
|
||||
$this->resetAfterTest(true);
|
||||
$mode = tool_uploadcourse_processor::MODE_CREATE_NEW;
|
||||
@@ -57,6 +52,7 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
|
||||
$data = array();
|
||||
$co = new tool_uploadcourse_course($mode, $updatemode, $data);
|
||||
$this->assertFalse($co->prepare());
|
||||
$this->expectException(moodle_exception::class);
|
||||
$co->proceed();
|
||||
}
|
||||
|
||||
@@ -1232,9 +1228,9 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
|
||||
|
||||
// Confirm presence of course custom fields.
|
||||
$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->assertEqualsIgnoringCase('Wednesday, 1 April 2020, 4:00 PM', $data->mydatefield);
|
||||
$this->assertEquals($dataupload['customfield_mytextfield'], $data->mytextfield);
|
||||
$this->assertContains($dataupload['customfield_mytextareafield'], $data->mytextareafield);
|
||||
$this->assertStringContainsString($dataupload['customfield_mytextareafield'], $data->mytextareafield);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1504,4 +1500,4 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
|
||||
'configdata' => $configdata,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,9 +160,6 @@ class tool_uploadcourse_processor_testcase extends advanced_testcase {
|
||||
$this->assertEquals('ID123: Course 1', $c->shortname);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException moodle_exception
|
||||
*/
|
||||
public function test_empty_csv() {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -174,12 +171,10 @@ class tool_uploadcourse_processor_testcase extends advanced_testcase {
|
||||
$cir->init();
|
||||
|
||||
$options = array('mode' => tool_uploadcourse_processor::MODE_CREATE_NEW);
|
||||
$this->expectException(moodle_exception::class);
|
||||
$p = new tool_uploadcourse_processor($cir, $options, array());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException moodle_exception
|
||||
*/
|
||||
public function test_not_enough_columns() {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -194,6 +189,7 @@ class tool_uploadcourse_processor_testcase extends advanced_testcase {
|
||||
$cir->init();
|
||||
|
||||
$options = array('mode' => tool_uploadcourse_processor::MODE_CREATE_NEW);
|
||||
$this->expectException(moodle_exception::class);
|
||||
$p = new tool_uploadcourse_processor($cir, $options, array());
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ use tool_usertours\local\filter\accessdate;
|
||||
*/
|
||||
class tool_usertours_accessdate_filter_test extends advanced_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -248,7 +248,7 @@ class cache_testcase extends advanced_testcase {
|
||||
$tour = $this->helper_create_tour((object)['enabled' => false]);
|
||||
|
||||
$data = \tool_usertours\cache::get_stepdata($tour->get_id());
|
||||
$this->assertInternalType('array', $data);
|
||||
$this->assertIsArray($data);
|
||||
$this->assertEmpty($data);
|
||||
}
|
||||
|
||||
@@ -265,11 +265,11 @@ class cache_testcase extends advanced_testcase {
|
||||
$tour2 = $this->helper_create_tour((object)['enabled' => false]);
|
||||
|
||||
$data = \tool_usertours\cache::get_stepdata($tour1->get_id());
|
||||
$this->assertInternalType('array', $data);
|
||||
$this->assertIsArray($data);
|
||||
$this->assertCount(3, $data);
|
||||
|
||||
$data = \tool_usertours\cache::get_stepdata($tour2->get_id());
|
||||
$this->assertInternalType('array', $data);
|
||||
$this->assertIsArray($data);
|
||||
$this->assertEmpty($data);
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ class cache_testcase extends advanced_testcase {
|
||||
$steps[0]->set_sortorder(10)->persist();
|
||||
|
||||
$data = \tool_usertours\cache::get_stepdata($tour->get_id());
|
||||
$this->assertInternalType('array', $data);
|
||||
$this->assertIsArray($data);
|
||||
$this->assertCount(4, $data);
|
||||
|
||||
// Re-order the steps.
|
||||
|
||||
@@ -47,7 +47,7 @@ class tool_usertours_manager_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Setup to store the DB reference.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->db = $DB;
|
||||
@@ -56,7 +56,7 @@ class tool_usertours_manager_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Tear down to restore the original DB reference.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
global $DB;
|
||||
|
||||
$DB = $this->db;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class tool_usertours_role_filter_testcase extends advanced_testcase {
|
||||
*/
|
||||
protected $roles;
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -44,7 +44,7 @@ class step_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Setup to store the DB reference.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->db = $DB;
|
||||
@@ -53,7 +53,7 @@ class step_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Tear down to restore the original DB reference.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
global $DB;
|
||||
|
||||
$DB = $this->db;
|
||||
|
||||
@@ -46,7 +46,7 @@ class tour_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Setup to store the DB reference.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->db = $DB;
|
||||
@@ -55,7 +55,7 @@ class tour_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Tear down to restore the original DB reference.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
global $DB;
|
||||
|
||||
$DB = $this->db;
|
||||
|
||||
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*/
|
||||
class core_analytics_course_testcase extends advanced_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->course = $this->getDataGenerator()->create_course(['startdate' => 0]);
|
||||
|
||||
@@ -38,7 +38,7 @@ class dataset_manager_testcase extends advanced_testcase {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$this->sharedtoprows = array(
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -70,7 +70,6 @@ class analytics_indicator_testcase extends advanced_testcase {
|
||||
* @param string $indicatorclass
|
||||
* @param string $willreturn
|
||||
* @dataProvider validate_calculated_value_exceptions
|
||||
* @expectedException \coding_exception
|
||||
* @return null
|
||||
*/
|
||||
public function test_validate_calculated_value_exceptions($indicatorclass, $willreturn) {
|
||||
@@ -80,6 +79,7 @@ class analytics_indicator_testcase extends advanced_testcase {
|
||||
->setMethods(['calculate_sample'])
|
||||
->getMock();
|
||||
$indicatormock->method('calculate_sample')->willReturn($willreturn);
|
||||
$this->expectException(coding_exception::class);
|
||||
list($values, $unused) = $indicatormock->calculate([1], 'notrelevanthere');
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ require_once(__DIR__ . '/fixtures/test_analysis.php');
|
||||
*/
|
||||
class analytics_model_testcase extends advanced_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -424,7 +424,7 @@ class analytics_model_testcase extends advanced_testcase {
|
||||
$modeldata = $method->invoke($modelconfig);
|
||||
|
||||
$this->assertArrayHasKey('core', $modeldata->dependencies);
|
||||
$this->assertInternalType('float', $modeldata->dependencies['core']);
|
||||
$this->assertIsFloat($modeldata->dependencies['core']);
|
||||
$this->assertNotEmpty($modeldata->target);
|
||||
$this->assertNotEmpty($modeldata->timesplitting);
|
||||
$this->assertCount(3, $modeldata->indicators);
|
||||
|
||||
@@ -39,7 +39,7 @@ class analytics_prediction_actions_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Common startup tasks
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -62,7 +62,7 @@ class core_analytics_prediction_testcase extends advanced_testcase {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
$this->setAdminUser();
|
||||
|
||||
$models = \core_analytics\manager::get_all_models();
|
||||
|
||||
@@ -44,7 +44,7 @@ require_once(__DIR__ . '/fixtures/test_target_course_users.php');
|
||||
*/
|
||||
class core_analytics_privacy_model_testcase extends \core_privacy\tests\provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -39,7 +39,7 @@ class analytics_stats_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Set up the test environment.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
|
||||
$this->setAdminUser();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class auth_email_external_testcase extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Set up for every test
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG, $DB;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -44,7 +44,7 @@ class auth_manual_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Setup test data.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->authplugin = new auth_plugin_manual();
|
||||
set_config('expiration', '1', 'auth_manual');
|
||||
|
||||
@@ -45,7 +45,7 @@ class auth_manual_privacy_testcase extends \core_privacy\tests\provider_testcase
|
||||
/**
|
||||
* Basic setup for these tests.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->authplugin = new auth_plugin_manual();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class auth_mnet_privacy_testcase extends provider_testcase {
|
||||
/**
|
||||
* Set up method.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
}
|
||||
|
||||
@@ -42,12 +42,9 @@ class auth_oauth2_auth_testcase extends advanced_testcase {
|
||||
$auth = get_auth_plugin($user->auth);
|
||||
$info = $auth->get_password_change_info($user);
|
||||
|
||||
$this->assertEquals(
|
||||
['subject', 'message'],
|
||||
array_keys($info),
|
||||
'', 0.0, 10, true);
|
||||
$this->assertContains(
|
||||
$this->assertEqualsCanonicalizing(['subject', 'message'], array_keys($info));
|
||||
$this->assertStringContainsString(
|
||||
'your password cannot be reset because you are using your account on another site to log in',
|
||||
$info['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class auth_oauth2_privacy_testcase extends provider_testcase {
|
||||
/**
|
||||
* Set up method.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class core_auth_external_testcase extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Set up for every test
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
@@ -60,7 +60,7 @@ class core_auth_external_testcase extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Tear down to restore old logging..
|
||||
*/
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
ini_set('error_log', $this->oldlog);
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ use core_auth\privacy\provider;
|
||||
*/
|
||||
class core_auth_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class availability_completion_condition_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Load required classes.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
availability_completion\condition::wipe_static_cache();
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -38,7 +38,7 @@ class availability_date_condition_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Load required classes.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Load the mock info class so that it can be used.
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/availability/tests/fixtures/mock_info.php');
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -37,7 +37,7 @@ class availability_group_condition_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Load required classes.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Load the mock info class so that it can be used.
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/availability/tests/fixtures/mock_info.php');
|
||||
@@ -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).
|
||||
|
||||
@@ -37,7 +37,7 @@ class availability_grouping_condition_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Load required classes.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Load the mock info class so that it can be used.
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/availability/tests/fixtures/mock_info.php');
|
||||
@@ -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.
|
||||
|
||||
@@ -45,7 +45,7 @@ class availability_profile_condition_testcase extends advanced_testcase {
|
||||
/** @var \core_availability\info Current info */
|
||||
private $info;
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB, $CFG;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -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).
|
||||
|
||||
@@ -36,7 +36,7 @@ use core_availability\info_section;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class info_testcase extends advanced_testcase {
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Load the mock condition so that it can be used.
|
||||
require_once(__DIR__ . '/fixtures/mock_condition.php');
|
||||
}
|
||||
@@ -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]);
|
||||
|
||||
@@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tree_testcase extends \advanced_testcase {
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Load the mock classes so they can be used.
|
||||
require_once(__DIR__ . '/fixtures/mock_condition.php');
|
||||
require_once(__DIR__ . '/fixtures/mock_info.php');
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class core_backup_controller_testcase extends advanced_testcase {
|
||||
protected $courseid; // course id used for testing
|
||||
protected $userid; // user used if for testing
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB, $CFG;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -41,7 +41,7 @@ class core_backup_moodle1_converter_testcase extends advanced_testcase {
|
||||
/** @var string saved hash of an icon file used during testing */
|
||||
protected $iconhash;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $CFG;
|
||||
|
||||
$this->tempdir = convert_helper::generate_id('unittest');
|
||||
@@ -75,7 +75,7 @@ class core_backup_moodle1_converter_testcase extends advanced_testcase {
|
||||
);
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
global $CFG;
|
||||
if (empty($CFG->keeptempdirectoriesonbackup)) {
|
||||
fulldelete($this->tempdirpath);
|
||||
@@ -92,17 +92,12 @@ class core_backup_moodle1_converter_testcase extends advanced_testcase {
|
||||
$this->assertInstanceOf('moodle1_converter', $converter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException moodle1_convert_storage_exception
|
||||
*/
|
||||
public function test_stash_storage_not_created() {
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$this->expectException(moodle1_convert_storage_exception::class);
|
||||
$converter->set_stash('tempinfo', 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException moodle1_convert_empty_storage_exception
|
||||
*/
|
||||
public function test_stash_requiring_empty_stash() {
|
||||
$this->resetAfterTest(true);
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
@@ -113,6 +108,7 @@ class core_backup_moodle1_converter_testcase extends advanced_testcase {
|
||||
|
||||
} catch (moodle1_convert_empty_storage_exception $e) {
|
||||
// we must drop the storage here so we are able to re-create it in the next test
|
||||
$this->expectException(moodle1_convert_empty_storage_exception::class);
|
||||
$converter->drop_stash_storage();
|
||||
throw new moodle1_convert_empty_storage_exception('rethrowing');
|
||||
}
|
||||
@@ -440,9 +436,6 @@ class core_backup_moodle1_converter_testcase extends advanced_testcase {
|
||||
$this->assertSame(null, $data['nothing']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException convert_path_exception
|
||||
*/
|
||||
public function test_grouped_data_on_nongrouped_convert_path() {
|
||||
// prepare some grouped data
|
||||
$data = array(
|
||||
@@ -468,12 +461,10 @@ class core_backup_moodle1_converter_testcase extends advanced_testcase {
|
||||
$path = new convert_path('beer_style', '/ROOT/BEER_STYLES/BEER_STYLE');
|
||||
|
||||
// an attempt to apply recipes throws exception because we do not expect grouped data
|
||||
$this->expectException(convert_path_exception::class);
|
||||
$data = $path->apply_recipes($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException convert_path_exception
|
||||
*/
|
||||
public function test_grouped_convert_path_with_recipes() {
|
||||
// prepare some grouped data
|
||||
$data = array(
|
||||
@@ -501,6 +492,7 @@ class core_backup_moodle1_converter_testcase extends advanced_testcase {
|
||||
$this->assertEquals('Heineken', $data['beers'][1]['beer']['name']);
|
||||
|
||||
// an attempt to provide explicit recipes on grouped elements throws exception
|
||||
$this->expectException(convert_path_exception::class);
|
||||
$path = new convert_path(
|
||||
'beer_style', '/ROOT/BEER_STYLES/BEER_STYLE',
|
||||
array(
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once($CFG->dirroot . '/backup/moodle2/backup_custom_fields.php');
|
||||
|
||||
class core_backup_encrypted_content_testscase extends advanced_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
if (!function_exists('openssl_encrypt')) {
|
||||
$this->markTestSkipped('OpenSSL extension is not loaded.');
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class backup_xml_transformer_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Initial set up.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -46,7 +46,7 @@ class core_backup_automated_backup_testcase extends advanced_testcase {
|
||||
*/
|
||||
protected $course;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB, $CFG;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -66,7 +66,7 @@ class core_backup_course_copy_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Set up tasks for all tests.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB, $CFG, $USER;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
@@ -633,4 +633,4 @@ class core_backup_course_copy_testcase extends advanced_testcase {
|
||||
$this->expectException(\moodle_exception::class);
|
||||
new \core_backup\copy\copy($formdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class backup_external_testcase extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Set up tasks for all tests.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $CFG;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
@@ -179,4 +179,4 @@ class backup_external_testcase extends externallib_advanced_testcase {
|
||||
$this->assertEquals(0, $restorerec->progress);
|
||||
$this->assertEquals('restore', $restorerec->operation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ class core_backup_privacy_provider_testcase extends \core_privacy\tests\provider
|
||||
$this->assertCount(2, $userlist1);
|
||||
$expected = [$user1->id, $user2->id];
|
||||
$actual = $userlist1->get_userids();
|
||||
$this->assertEquals($expected, $actual, '', 0.0, 10, true);
|
||||
$this->assertEqualsCanonicalizing($expected, $actual);
|
||||
|
||||
// The list of users for coursecontext2 should not return users.
|
||||
$userlist2 = new \core_privacy\local\request\userlist($coursecontext2, $component);
|
||||
|
||||
@@ -39,7 +39,7 @@ class backup_check_testcase extends advanced_testcase {
|
||||
protected $courseid; // course id used for testing
|
||||
protected $userid; // user record id
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB, $CFG;
|
||||
parent::setUp();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class backup_dbops_testcase extends advanced_testcase {
|
||||
protected $courseid; // course id used for testing
|
||||
protected $userid; // user record used for testing
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB, $CFG;
|
||||
parent::setUp();
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ require_once($CFG->dirroot . '/backup/util/factories/backup_factory.class.php');
|
||||
*/
|
||||
class backup_factories_testcase extends advanced_testcase {
|
||||
|
||||
function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
parent::setUp();
|
||||
|
||||
@@ -57,7 +57,7 @@ class backup_factories_testcase extends advanced_testcase {
|
||||
/**
|
||||
* test get_logger_chain() method
|
||||
*/
|
||||
function test_backup_factory() {
|
||||
public function test_backup_factory() {
|
||||
global $CFG;
|
||||
|
||||
// Default instantiate, all levels = backup::LOG_NONE
|
||||
|
||||
@@ -42,7 +42,7 @@ class restore_structure_parser_processor_test extends advanced_testcase {
|
||||
/**
|
||||
* Initial set up.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -36,7 +36,7 @@ class backup_plan_testcase extends advanced_testcase {
|
||||
protected $courseid; // course id used for testing
|
||||
protected $userid; // user record used for testing
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB, $CFG;
|
||||
parent::setUp();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class backup_step_testcase extends advanced_testcase {
|
||||
protected $courseid; // course id used for testing
|
||||
protected $userid; // user record used for testing
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB, $CFG;
|
||||
parent::setUp();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class backup_task_testcase extends advanced_testcase {
|
||||
protected $courseid; // course id used for testing
|
||||
protected $userid; // user record used for testing
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB, $CFG;
|
||||
parent::setUp();
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class backup_structure_testcase extends advanced_testcase {
|
||||
protected $contextid;
|
||||
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -43,7 +43,7 @@ class core_badges_badgeslib_testcase extends advanced_testcase {
|
||||
/** @var $assertion2 to define json format for Open badge version 2 */
|
||||
protected $assertion2;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB, $CFG;
|
||||
$this->resetAfterTest(true);
|
||||
$CFG->enablecompletion = true;
|
||||
@@ -199,15 +199,15 @@ class core_badges_badgeslib_testcase extends advanced_testcase {
|
||||
$badge = new badge($this->badgeid);
|
||||
$old_status = $badge->status;
|
||||
$badge->set_status(BADGE_STATUS_ACTIVE);
|
||||
$this->assertAttributeNotEquals($old_status, 'status', $badge);
|
||||
$this->assertAttributeEquals(BADGE_STATUS_ACTIVE, 'status', $badge);
|
||||
$this->assertNotEquals($old_status, $badge->status);
|
||||
$this->assertEquals(BADGE_STATUS_ACTIVE, $badge->status);
|
||||
}
|
||||
|
||||
public function test_delete_badge() {
|
||||
$badge = new badge($this->badgeid);
|
||||
$badge->delete();
|
||||
// We don't actually delete badges. We archive them.
|
||||
$this->assertAttributeEquals(BADGE_STATUS_ARCHIVED, 'status', $badge);
|
||||
$this->assertEquals(BADGE_STATUS_ARCHIVED, $badge->status);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -385,7 +385,7 @@ class core_badges_badgeslib_testcase extends advanced_testcase {
|
||||
|
||||
// Make sure the first user has no badges.
|
||||
$result = badges_get_user_badges($user1->id);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertCount(0, $result);
|
||||
|
||||
// Check that the second user has the expected 11 badges.
|
||||
|
||||
@@ -45,7 +45,7 @@ class core_badges_external_testcase extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Set up for every test
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -48,7 +48,7 @@ require_once($CFG->libdir . '/badgeslib.php');
|
||||
*/
|
||||
class core_badges_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class block_comments_events_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Setup test data.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class block_comments_privacy_provider_testcase extends \core_privacy\tests\provi
|
||||
/** @var stdClass A test course. */
|
||||
protected $course2;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -209,7 +209,7 @@ class block_comments_privacy_provider_testcase extends \core_privacy\tests\provi
|
||||
$this->assertCount(2, $contextlist);
|
||||
|
||||
$contextids = $contextlist->get_contextids();
|
||||
$this->assertEquals([$coursecontext1->id, $coursecontext2->id], $contextids, '', 0.0, 10, true);
|
||||
$this->assertEqualsCanonicalizing([$coursecontext1->id, $coursecontext2->id], $contextids);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,7 +47,7 @@ class block_online_users_testcase extends advanced_testcase {
|
||||
* Prepare the site with some courses, groups, users and
|
||||
* simulate various recent accesses.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
|
||||
// Generate (simulated) recently logged-in users.
|
||||
$generator = $this->getDataGenerator()->get_plugin_generator('block_online_users');
|
||||
|
||||
@@ -42,7 +42,7 @@ class block_recentlyaccesseditems_observer_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Set up for every test
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -157,4 +157,4 @@ class block_recentlyaccesseditems_observer_testcase extends advanced_testcase {
|
||||
$records = $DB->count_records($this->table, array('cmid' => $this->chat->cmid));
|
||||
$this->assertEquals(2, $records);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,7 +38,7 @@ class block_rss_client_testcase extends provider_testcase {
|
||||
/**
|
||||
* Basic setup for these tests.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user