Test fix - allow clear messages to clear multiple messages
authoreileenmcnaugton <eileen@fuzion.co.nz>
Thu, 26 Nov 2015 07:05:36 +0000 (20:05 +1300)
committereileenmcnaugton <eileen@fuzion.co.nz>
Thu, 26 Nov 2015 07:12:46 +0000 (20:12 +1300)
tests/phpunit/CiviTest/CiviMailUtils.php

index d70d0ee183d265ae3bc2e4ca5860365bdf4875bf..e3ba1266af19344f9233e317fd6fc33aea1738c0 100644 (file)
@@ -317,13 +317,17 @@ class CiviMailUtils extends PHPUnit_Framework_TestCase {
 
   /**
    * Remove any sent messages from the log.
+   *
+   * @param int $limit
+   *
+   * @throws \Exception
    */
-  public function clearMessages() {
+  public function clearMessages($limit = 1) {
     if ($this->_webtest) {
       throw new Exception("Not implementated: clearMessages for WebTest");
     }
     else {
-      CRM_Core_DAO::executeQuery('DELETE FROM civicrm_mailing_spool ORDER BY id DESC LIMIT 1');
+      CRM_Core_DAO::executeQuery('DELETE FROM civicrm_mailing_spool ORDER BY id DESC LIMIT '. $limit);
     }
   }