From b38530f25a9eabdf4556517020a6306b9f85961d Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 28 Apr 2014 09:30:37 -0700 Subject: [PATCH] test fix - add clobber-it tear down function for financial transactions so we remove them all --- .../CRM/Core/Payment/AuthorizeNetTest.php | 3 +-- .../phpunit/CRM/Core/Payment/BaseIPNTest.php | 16 +------------ .../CRM/Core/Payment/PayPalProIPNTest.php | 12 +--------- tests/phpunit/CiviTest/CiviUnitTestCase.php | 23 +++++++++++++++++++ 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php b/tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php index b5a7eeb70b..07cf30a864 100644 --- a/tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php +++ b/tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php @@ -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(); } /** diff --git a/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php b/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php index f81265fdcc..33da3c3fca 100644 --- a/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php +++ b/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php @@ -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); } diff --git a/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php b/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php index c812fc5e11..918636b84f 100644 --- a/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php +++ b/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php @@ -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(); } /** diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index f28677abd2..1c1963a46e 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -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 -- 2.25.1