Merge branch 'MDL-71389-311' of git://github.com/marinaglancy/moodle into MOODLE_311_STABLE

This commit is contained in:
Andrew Nicols
2021-04-28 09:49:48 +08:00
6 changed files with 20 additions and 13 deletions
+3 -3
View File
@@ -128,7 +128,7 @@ class backp_settings_testcase extends basic_testcase {
$this->assertEquals($e->errorcode, 'incorrect_object_passed');
} catch (TypeError $e) {
// On PHP7+ we get a TypeError raised, lets check we've the right error.
$this->assertMatchesRegularExpression('/must be an instance of backup_setting_ui/', $e->getMessage());
$this->assertMatchesRegularExpression('/must be (of type|an instance of) backup_setting_ui/', $e->getMessage());
}
restore_error_handler();
@@ -145,7 +145,7 @@ class backp_settings_testcase extends basic_testcase {
$this->assertEquals($e->errorcode, 'incorrect_object_passed');
} catch (TypeError $e) {
// On PHP7+ we get a TypeError raised, lets check we've the right error.
$this->assertMatchesRegularExpression('/must be an instance of backup_setting_ui/', $e->getMessage());
$this->assertMatchesRegularExpression('/must be (of type|an instance of) backup_setting_ui/', $e->getMessage());
}
restore_error_handler();
@@ -354,7 +354,7 @@ class backp_settings_testcase extends basic_testcase {
$this->assertEquals($e->errorcode, 'incorrect_object_passed');
} catch (TypeError $e) {
// On PHP7+ we get a TypeError raised, lets check we've the right error.
$this->assertMatchesRegularExpression('/must be an instance of base_setting/', $e->getMessage());
$this->assertMatchesRegularExpression('/must be (an instance of|of type) base_setting/', $e->getMessage());
}
restore_error_handler();
-1
View File
@@ -96,7 +96,6 @@ class core_phpunit_basic_testcase extends basic_testcase {
$this->assertEquals(1, '1');
$this->assertEquals(null, '');
$this->assertNotEquals(1, '1 ');
$this->assertNotEquals(0, '');
$this->assertNotEquals(null, '0');
$this->assertNotEquals(array(), '');
+1 -1
View File
@@ -216,7 +216,7 @@ class encryption_testcase extends \basic_testcase {
switch ($method) {
case encryption::METHOD_SODIUM:
$this->expectExceptionMessage('key size should be');
$this->expectExceptionMessageMatches('/(should|must) be SODIUM_CRYPTO_SECRETBOX_KEYBYTES bytes/');
break;
case encryption::METHOD_OPENSSL:
+5 -1
View File
@@ -857,7 +857,11 @@ class core_event_testcase extends advanced_testcase {
// all that was done is to move the annotation (deprecated) to
// explicit expectation. Still try commenting it out and you'll see
// the notice.
$this->expectNotice();
if (PHP_VERSION_ID >= 80000) {
$this->expectWarning();
} else {
$this->expectNotice();
}
$event = \core_tests\event\context_used_in_event::create(array('other' => array('sample' => 1, 'xx' => 10)));
$this->assertEventContextNotUsed($event);
+5 -1
View File
@@ -2302,7 +2302,11 @@ EOF;
public function test_get_string_limitation() {
// This is one of the limitations to the lang_string class. It can't be
// used as a key.
$this->expectWarning();
if (PHP_VERSION_ID >= 80000) {
$this->expectException(TypeError::class);
} else {
$this->expectWarning();
}
$array = array(get_string('yes', null, null, true) => 'yes');
}
+6 -6
View File
@@ -1016,8 +1016,8 @@ class mod_forum_mail_testcase extends advanced_testcase {
'contents' => array(
'~{$a',
'~&(amp|lt|gt|quot|\#039);(?!course)',
'Attachment example.txt:' . PHP_EOL .
'https://www.example.com/moodle/pluginfile.php/\d*/mod_forum/attachment/\d*/example.txt' . PHP_EOL,
'Attachment example.txt:' . '\r*\n' .
'https://www.example.com/moodle/pluginfile.php/\d*/mod_forum/attachment/\d*/example.txt' . '\r*\n',
'Hello Moodle', 'Moodle Forum', 'Welcome.*Moodle', 'Love Moodle', '1\d1'
),
),
@@ -1075,12 +1075,12 @@ class mod_forum_mail_testcase extends advanced_testcase {
$newcase['expectations'][0]['contents'] = array(
'~{$a',
'~&(amp|lt|gt|quot|\#039);(?!course)',
'Attachment example.txt:' . PHP_EOL .
'https://www.example.com/moodle/pluginfile.php/\d*/mod_forum/attachment/\d*/example.txt' . PHP_EOL ,
'Attachment example.txt:' . '\r*\n' .
'https://www.example.com/moodle/pluginfile.php/\d*/mod_forum/attachment/\d*/example.txt' . '\r*\n' ,
'Text and image', 'Moodle Forum',
'Welcome to Moodle, *' . PHP_EOL . '.*'
'Welcome to Moodle, *' . '\r*\n' . '.*'
.'https://www.example.com/moodle/pluginfile.php/\d+/mod_forum/post/\d+/'
.'Screen%20Shot%202016-03-22%20at%205\.54\.36%20AM%20%281%29\.png *' . PHP_EOL . '.*!',
.'Screen%20Shot%202016-03-22%20at%205\.54\.36%20AM%20%281%29\.png *' . '\r*\n' . '.*!',
'Love Moodle', '1\d1');
$textcases['Text mail with text+image message i.e. @@PLUGINFILE@@ token handling'] = array('data' => $newcase);