Commit b829de68 authored by catch's avatar catch
Browse files

Issue #3082859 by Krzysztof Domański, munish.kumar, xjm, samuel.mortenson: The...

Issue #3082859 by Krzysztof Domański, munish.kumar, xjm, samuel.mortenson: The AssertMailTrait should cast the data type to boolean in assertMailPattern
parent 264d89cf
......@@ -138,7 +138,7 @@ protected function assertMailPattern($field_name, $regex, $message = '', $group
if (!$message) {
$message = new FormattableMarkup('Expected text found in @field of email message: "@expected".', ['@field' => $field_name, '@expected' => $regex]);
}
return $this->assertTrue($regex_found, $message, $group);
return $this->assertTrue((bool) $regex_found, $message, $group);
}
/**
......
......@@ -45,6 +45,12 @@ public function testAssertMailTrait() {
$captured_emails = $this->getMails();
$this->assertCount(1, $captured_emails, 'One email was captured.');
// Asserts that the message fields have the pattern in it.
$this->assertMailPattern('id', $message['id']);
$this->assertMailPattern('subject', "^.{64}$");
$this->assertMailPattern('to', "[a-z]{6}@example\.com$");
$this->assertMailPattern('body', "^.{128}$");
// Assert that the email was sent by iterating over the message properties
// and ensuring that they are captured intact.
foreach ($message as $field => $value) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment