diff --git a/src/D8/EmailTrait.php b/src/D8/EmailTrait.php index 1995da46..9c4bbdae 100644 --- a/src/D8/EmailTrait.php +++ b/src/D8/EmailTrait.php @@ -136,7 +136,7 @@ public function emailAssertEmailContains($field, PyStringNode $string, $exact = $string = strval($string); $string = $exact ? $string : trim(preg_replace('/\s+/', ' ', $string)); foreach (self::emailGetCollectedEmails() as $email) { - $field_string = $email['params'][$field] ?? $email[$field]; + $field_string = $email[$field] ?? ''; $field_string = $exact ? $field_string : trim(preg_replace('/\s+/', ' ', $field_string)); if (strpos($field_string, $string) !== FALSE) { return $email; diff --git a/tests/behat/fixtures/d8/docroot/modules/custom/mysite_core/mysite_core.module b/tests/behat/fixtures/d8/docroot/modules/custom/mysite_core/mysite_core.module index 2a4a86e2..89f8edc5 100644 --- a/tests/behat/fixtures/d8/docroot/modules/custom/mysite_core/mysite_core.module +++ b/tests/behat/fixtures/d8/docroot/modules/custom/mysite_core/mysite_core.module @@ -24,4 +24,5 @@ function mysite_core_mail($key, &$message, $params) { $message['subject'] = t('Test Email'); break; } + $message['body'][] = strval($params['body']) ?? ''; }