MDL-48197 testing: Normalise uses of noemailever and phpmailer sink

This commit is contained in:
Andrew Nicols
2014-11-19 09:09:50 +08:00
parent 556e3a9e8a
commit fc05c1b8e5
9 changed files with 20 additions and 27 deletions
+5 -3
View File
@@ -2607,6 +2607,11 @@ class core_moodlelib_testcase extends advanced_testcase {
$subject2 = 'subject 2';
$messagetext2 = 'message text 2';
// Close the default email sink.
$sink = $this->redirectEmails();
$sink->close();
$CFG->noemailever = true;
$this->assertNotEmpty($CFG->noemailever);
email_to_user($user1, $user2, $subject, $messagetext);
$this->assertDebuggingCalled('Not sending email due to $CFG->noemailever config setting');
@@ -2660,9 +2665,6 @@ class core_moodlelib_testcase extends advanced_testcase {
$user = $this->getDataGenerator()->create_user();
// Set config to allow email_to_user() to be called.
$CFG->noemailever = false;
// Update user password.
$sink = $this->redirectEvents();
$sink2 = $this->redirectEmails(); // Make sure we are redirecting emails.