From: colemanw Date: Tue, 21 Nov 2023 13:13:11 +0000 (-0500) Subject: Merge pull request #28214 from eileenmcnaughton/message_improve X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5b0065d28ddf3e96a734fb7cd5740e308b24a489;p=civicrm-core.git Merge pull request #28214 from eileenmcnaughton/message_improve Improve test output message --- 5b0065d28ddf3e96a734fb7cd5740e308b24a489 diff --cc Civi/Test/FormTrait.php index 47c602c9c7,a46a106249..757085ae1b --- a/Civi/Test/FormTrait.php +++ b/Civi/Test/FormTrait.php @@@ -77,20 -65,9 +77,20 @@@ trait FormTrait */ protected function assertMailSentContainingString(string $string, int $mailIndex = 0): void { $mail = $this->form->getMail()[$mailIndex]; - $this->assertStringContainsString(preg_replace('/\s+/', '', $string), preg_replace('/\s+/', '', $mail['body'])); + $this->assertStringContainsString(preg_replace('/\s+/', '', $string), preg_replace('/\s+/', '', $mail['body']), 'String not found: ' . $string . "\n" . $mail['body']); } + /** + * Assert that the sent mail included the supplied string. + * + * @param string $string + * @param int $mailIndex + */ + protected function assertMailSentNotContainingString(string $string, int $mailIndex = 0): void { + $mail = $this->form->getMail()[$mailIndex]; + $this->assertStringNotContainsString(preg_replace('/\s+/', '', $string), preg_replace('/\s+/', '', $mail['body'])); + } + /** * Assert that the sent mail included the supplied string. *