forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'MDL-75573' of https://github.com/paulholden/moodle
- Loading branch information
Showing
2 changed files
with
27 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
* Asyncronhous helper tests. | ||
* | ||
* @package core_backup | ||
* @covers \async_helper | ||
* @copyright 2018 Matt Porritt <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
@@ -47,7 +48,7 @@ public function test_send_message() { | |
set_config('backup_async_message_users', '1', 'backup'); | ||
set_config('backup_async_message_subject', 'Moodle {operation} completed sucessfully', 'backup'); | ||
set_config('backup_async_message', | ||
'Dear {user_firstname} {user_lastname}, <br/> Your {operation} (ID: {backupid}) has completed successfully!', | ||
'Dear {user_firstname} {user_lastname}, your {operation} (ID: {backupid}) has completed successfully!', | ||
'backup'); | ||
set_config('allowedemaildomains', 'example.com'); | ||
|
||
|
@@ -76,15 +77,17 @@ public function test_send_message() { | |
$this->assertCount(1, $emails); | ||
$email = reset($emails); | ||
|
||
$this->assertSame($USER->email, $email->from); | ||
$this->assertSame($user2->email, $email->to); | ||
$this->assertSame('Moodle backup completed sucessfully', $email->subject); | ||
$this->assertNotEmpty($email->header); | ||
$this->assertNotEmpty($email->body); | ||
$this->assertMatchesRegularExpression("/$backupid/", $email->body); | ||
$this->assertThat($email->body, $this->logicalNot($this->stringContains('{'))); | ||
$this->assertGreaterThan(0, $messageid); | ||
$sink->clear(); | ||
|
||
$this->assertSame($USER->email, $email->from); | ||
$this->assertSame($user2->email, $email->to); | ||
$this->assertSame('Moodle Backup completed sucessfully', $email->subject); | ||
|
||
// Assert body placeholders have all been replaced. | ||
$this->assertStringContainsString('Dear test human, your Backup', $email->body); | ||
$this->assertStringContainsString("(ID: {$backupid})", $email->body); | ||
$this->assertStringNotContainsString('{', $email->body); | ||
} | ||
|
||
/** | ||
|