Merge pull request #20330 from mattwire/fixpaymentformstest
[civicrm-core.git] / tests / phpunit / CiviTest / CiviMailUtils.php
index d7836fc8ab5e4517700ac15bc1ee3f11e7ddf2ed..b0a98b13e4dbfb6cfecddd609ec09123e5e2612b 100644 (file)
@@ -62,6 +62,16 @@ class CiviMailUtils extends PHPUnit\Framework\TestCase {
     }
   }
 
+  /**
+   * Clean up after test.
+   *
+   * @throws \CRM_Core_Exception
+   */
+  public function __destruct() {
+    $this->stop();
+    $this->clearMessages();
+  }
+
   /**
    * Start writing emails to db instead of current option.
    */
@@ -346,13 +356,13 @@ class CiviMailUtils extends PHPUnit\Framework\TestCase {
   }
 
   /**
-   * @param $strings
+   * @param array $strings
    * @param $absentStrings
    * @param $prefix
    * @param $mail
    * @return mixed
    */
-  public function checkMailForStrings($strings, $absentStrings, $prefix, $mail) {
+  public function checkMailForStrings(array $strings, $absentStrings = [], $prefix = '', $mail) {
     foreach ($strings as $string) {
       $this->_ut->assertContains($string, $mail, "$string .  not found in  $mail  $prefix");
     }