Merge pull request #28214 from eileenmcnaughton/message_improve
authorcolemanw <coleman@civicrm.org>
Tue, 21 Nov 2023 13:13:11 +0000 (08:13 -0500)
committerGitHub <noreply@github.com>
Tue, 21 Nov 2023 13:13:11 +0000 (08:13 -0500)
Improve test output message

1  2 
Civi/Test/FormTrait.php

index 47c602c9c70f7a45441234df72d9e1a2e2cbcb67,a46a106249720c09d84aae2339a2610456564df6..757085ae1b022e4616946cdc5578d0dd760289ae
@@@ -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.
     *