test fix - add clobber-it tear down function for financial transactions so we remove...
authorEileen McNaughton <eileen@fuzion.co.nz>
Mon, 28 Apr 2014 16:30:37 +0000 (09:30 -0700)
committerEileen McNaughton <eileen@fuzion.co.nz>
Mon, 28 Apr 2014 16:32:17 +0000 (09:32 -0700)
tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php
tests/phpunit/CRM/Core/Payment/BaseIPNTest.php
tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php
tests/phpunit/CiviTest/CiviUnitTestCase.php

index b5a7eeb70b7c49b4d132ebe89bc00f53f938799e..07cf30a864be5f5ec5cf729b775fa97946d94c3e 100644 (file)
@@ -60,8 +60,7 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase {
 
   function tearDown() {
     $this->paymentProcessor->delete($this->processorParams->id);
-    $tablesToTruncate = array('civicrm_contribution', 'civicrm_contribution_recur', 'civicrm_line_item' );
-    $this->quickCleanup($tablesToTruncate);
+    $this->quickCleanUpFinancialEntities();
   }
 
   /**
index f81265fdcc81d8e0c806b60dc7d637a0511f940f..33da3c3fca814b82ae9ffcf6620722dd1dd8c928 100644 (file)
@@ -109,21 +109,7 @@ class CRM_Core_Payment_BaseIPNTest extends CiviUnitTestCase {
   }
 
   function tearDown() {
-
-    $tablesToTruncate = array(
-      'civicrm_contribution',
-      'civicrm_contribution_recur',
-      'civicrm_membership',
-      'civicrm_membership_type',
-      'civicrm_membership_payment',
-      'civicrm_membership_status',
-      'civicrm_payment_processor',
-      'civicrm_event',
-      'civicrm_participant',
-      'civicrm_pledge',
-      'civicrm_line_item',
-    );
-    $this->quickCleanup($tablesToTruncate);
+    $this->quickCleanUpFinancialEntities();
     CRM_Member_PseudoConstant::membershipType(NULL, TRUE);
     CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'name', TRUE);
   }
index c812fc5e11b488a5814d17294c884cff65abe179..918636b84f9a42c6c213d5c9683930ae4d9473fe 100644 (file)
@@ -65,17 +65,7 @@ class CRM_Core_Payment_PayPalProIPNTest extends CiviUnitTestCase {
   }
 
   function tearDown() {
-  // $this->paymentProcessor->delete($this->processorParams->id);
-    $tablesToTruncate = array(
-      'civicrm_contribution',
-      'civicrm_financial_trxn',
-      'civicrm_contribution_recur',
-      'civicrm_line_item',
-      'civicrm_contribution_page',
-      'civicrm_payment_processor',
-      'civicrm_entity_financial_trxn',
-    );
-    $this->quickCleanup($tablesToTruncate);
+    $this->quickCleanUpFinancialEntities();
   }
 
   /**
index f28677abd29c445c9f93e0d79183ab6d4b137121..1c1963a46e6d6c03be52ef711312a384126731b7 100644 (file)
@@ -2115,6 +2115,29 @@ AND    ( TABLE_NAME LIKE 'civicrm_value_%' )
     }
   }
 
+  /**
+   * Clean up financial entities after financial tests (so we remember to get all the tables :-))
+   */
+  function quickCleanUpFinancialEntities() {
+    $tablesToTruncate = array(
+      'civicrm_contribution',
+      'civicrm_financial_trxn',
+      'civicrm_contribution_recur',
+      'civicrm_line_item',
+      'civicrm_contribution_page',
+      'civicrm_payment_processor',
+      'civicrm_entity_financial_trxn',
+      'civicrm_membership',
+      'civicrm_membership_type',
+      'civicrm_membership_payment',
+      'civicrm_membership_status',
+      'civicrm_event',
+      'civicrm_participant',
+      'civicrm_participant_payment',
+      'civicrm_pledge',
+    );
+    $this->quickCleanup($tablesToTruncate);
+  }
   /*
    * Function does a 'Get' on the entity & compares the fields in the Params with those returned
    * Default behaviour is to also delete the entity