From 108ff21a0afa66818341c85cb50885efaad925d8 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 3 Sep 2014 17:07:17 +1200 Subject: [PATCH] CRM-15207 test fix - rebuild default contribution price set --- tests/phpunit/CiviTest/CiviUnitTestCase.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 2865cef374..245fcf9be0 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -2378,9 +2378,17 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) 'civicrm_participant_payment', 'civicrm_pledge', 'civicrm_price_set_entity', + 'civicrm_price_field_value', + 'civicrm_price_field', ); $this->quickCleanup($tablesToTruncate); CRM_Core_DAO::executeQuery("DELETE FROM civicrm_membership_status WHERE name NOT IN('New', 'Current', 'Grace', 'Expired', 'Pending', 'Cancelled', 'Deceased')"); + $this->restoreDefaultPriceSetConfig(); + } + + function restoreDefaultPriceSetConfig() { + CRM_Core_DAO::executeQuery("INSERT INTO `civicrm_price_field` (`id`, `price_set_id`, `name`, `label`, `html_type`, `is_enter_qty`, `help_pre`, `help_post`, `weight`, `is_display_amounts`, `options_per_line`, `is_active`, `is_required`, `active_on`, `expire_on`, `javascript`, `visibility_id`) VALUES (1, 1, 'contribution_amount', 'Contribution Amount', 'Text', 0, NULL, NULL, 1, 1, 1, 1, 1, NULL, NULL, NULL, 1)"); + CRM_Core_DAO::executeQuery("INSERT INTO `civicrm_price_field_value` (`id`, `price_field_id`, `name`, `label`, `description`, `amount`, `count`, `max_value`, `weight`, `membership_type_id`, `membership_num_terms`, `is_default`, `is_active`, `financial_type_id`, `deductible_amount`) VALUES (1, 1, 'contribution_amount', 'Contribution Amount', NULL, '1', NULL, NULL, 1, NULL, NULL, 0, 1, 1, 0.00)"); } /* * Function does a 'Get' on the entity & compares the fields in the Params with those returned @@ -2809,7 +2817,7 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) function setupACL() { global $_REQUEST; $_REQUEST = $this->_params; - + CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM'); $optionGroupID = $this->callAPISuccessGetValue('option_group', array('return' => 'id', 'name' => 'acl_role')); $optionValue = $this->callAPISuccess('option_value', 'create', array('option_group_id' => $optionGroupID, -- 2.25.1