MDL-71919 core_message: Fix tests in message_send
authorcescobedo <carlos.escobedo@gmail.com>
Thu, 8 Jul 2021 07:24:00 +0000 (09:24 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 8 Jul 2021 21:30:35 +0000 (23:30 +0200)
lib/tests/message_test.php
lib/tests/messagelib_test.php

index a519a12..eefd415 100644 (file)
@@ -174,7 +174,7 @@ class core_message_testcase extends advanced_testcase {
         $this->assertSame(get_string('unreadnewmessage', 'message', fullname($user1)), $email->subject);
         $this->assertNotEmpty($email->header);
         $this->assertNotEmpty($email->body);
-        $this->assertMatchesRegularExpression('/test message body.*test/s', $email->body);
+        $this->assertMatchesRegularExpression('/test.*message body.*test/s', $email->body);
         $sink->clear();
 
         // Test that event fired includes the courseid.
@@ -214,7 +214,7 @@ class core_message_testcase extends advanced_testcase {
         $this->assertSame(get_string('unreadnewmessage', 'message', fullname($user1)), $email->subject);
         $this->assertNotEmpty($email->header);
         $this->assertNotEmpty($email->body);
-        $this->assertDoesNotMatchRegularExpression('/test message body test/', $email->body);
+        $this->assertDoesNotMatchRegularExpression('/test.*message body test/', $email->body);
 
         // Test that event fired includes the courseid.
         $eventsink = $this->redirectEvents();
index a646872..b77b08f 100644 (file)
@@ -808,7 +808,7 @@ class core_messagelib_testcase extends advanced_testcase {
         // so verify the expected beginning and ends.
         $this->assertNotEmpty($email->header);
         $this->assertNotEmpty($email->body);
-        $this->assertMatchesRegularExpression('/test message body.*test/s', $email->body);
+        $this->assertMatchesRegularExpression('/test.*message body.*test/s', $email->body);
         $sink->clear();
 
         // Now, send the message again, and verify that the event fired includes the courseid and conversationid.