From: Eileen McNaughton Date: Sun, 19 Oct 2014 08:15:53 +0000 (+1300) Subject: minor tidy ups X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a9ac877b2a1ac222b5a2da83229b3e1ed0651902;p=civicrm-core.git minor tidy ups --- diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index f8959c8da9..f007c51202 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -1901,7 +1901,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { } //have a crack @ deleting it first in the hope this will prevent derailing our tests - $check = $this->callAPISuccess('custom_group', 'get', array('title' => $params['title'], array('api.custom_group.delete' => 1))); + $this->callAPISuccess('custom_group', 'get', array('title' => $params['title'], array('api.custom_group.delete' => 1))); return $this->callAPISuccess('custom_group', 'create', $params); } @@ -2936,6 +2936,7 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) $result = $this->callAPISuccess('payment_processor', 'create', $params); return $result['id']; } + /** * Set up initial recurring payment allowing subsequent IPN payments */ @@ -2964,12 +2965,31 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) $this->_contributionID = $contributionRecur['values']['0']['api.contribution.create']['id']; } + /** + * we don't have a good way to set up a recurring contribution with a membership so let's just do one then alter it + */ + function setupMembershipRecurringPaymentProcessorTransaction() { + $this->setupRecurringPaymentProcessorTransaction(); + $this->ids['membership_type'] = $this->membershipTypeCreate(); + $this->ids['membership'] = $this->callAPISuccess('membership', 'create', array( + 'contact_id' => $this->_contactID, + 'membership_type_id' => $this->ids['membership_type'], + 'contribution_recur_id' => $this->_contributionRecurID, + 'api.membership_payment.create' => array('contribution_id' => $this->_contributionID), + 'format.only_id' => TRUE, + )); + CRM_Core_DAO::executeQuery( + "UPDATE civicrm_line_item SET entity_table = 'civicrm_membership', entity_id = {$this->ids['membership']} + WHERE entity_id = {$this->_contributionID} AND entity_table = 'civicrm_contribution'" + ); + } /** * @param $message * * @throws Exception - */function CiviUnitTestCase_fatalErrorHandler($message) { - throw new Exception("{$message['message']}: {$message['code']}"); -} + */ + function CiviUnitTestCase_fatalErrorHandler($message) { + throw new Exception("{$message['message']}: {$message['code']}"); + } }