mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-58121 email: ensure support user is defined in email_to_user
This commit is contained in:
parent
98c4094eac
commit
62b482938b
2 changed files with 14 additions and 0 deletions
|
@ -2859,6 +2859,19 @@ class core_moodlelib_testcase extends advanced_testcase {
|
|||
$this->assertNotEquals($CFG->noreplyaddress, $result[0]->from);
|
||||
$this->assertEquals($CFG->noreplyaddress, $result[1]->from);
|
||||
$sink->close();
|
||||
|
||||
// Try to send an unsafe attachment, we should see an error message in the eventual mail body.
|
||||
$attachment = '../test.txt';
|
||||
$attachname = 'txt';
|
||||
|
||||
$sink = $this->redirectEmails();
|
||||
email_to_user($user1, $user2, $subject, $messagetext, '', $attachment, $attachname);
|
||||
$this->assertSame(1, $sink->count());
|
||||
$result = $sink->get_messages();
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertContains('error.txt', $result[0]->body);
|
||||
$this->assertContains('Error in attachment. User attempted to attach a filename with a unsafe name.', $result[0]->body);
|
||||
$sink->close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue