From: eileenmcnaugton Date: Mon, 10 Aug 2015 02:38:48 +0000 (+1200) Subject: CRM-16993 test to replicate failure X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=bf6ba9fc33541f12d2dffd146d4b4ff82d5f029d;p=civicrm-core.git CRM-16993 test to replicate failure --- diff --git a/tests/phpunit/CRM/Member/Form/MembershipTest.php b/tests/phpunit/CRM/Member/Form/MembershipTest.php index d788f33da5..5016f6da5e 100644 --- a/tests/phpunit/CRM/Member/Form/MembershipTest.php +++ b/tests/phpunit/CRM/Member/Form/MembershipTest.php @@ -517,6 +517,42 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { ), 1); } + /** + * Test the submit function of the membership form. + */ + public function testSubmitRecurCompleteInstant() { + $form = $this->getForm(); + + $processor = Civi\Payment\System::singleton()->getById($this->_paymentProcessorID); + $processor->setDoDirectPaymentResult(array('payment_status_id' => 1, 'trxn_id' => 'kettles boil water')); + $this->callAPISuccess('MembershipType', 'create', array( + 'id' => $this->membershipTypeAnnualFixedID, + 'duration_unit' => 'month', + 'duration_interval' => 1, + 'auto_renew' => TRUE, + )); + $form->preProcess(); + $this->createLoggedInUser(); + $params = $this->getBaseSubmitParams(); + $form->_mode = 'test'; + + $form->submit($params); + $membership = $this->callAPISuccessGetSingle('Membership', array('contact_id' => $this->_individualId)); + $this->callAPISuccessGetCount('ContributionRecur', array('contact_id' => $this->_individualId), 1); + + $contribution = $this->callAPISuccess('Contribution', 'get', array( + 'contact_id' => $this->_individualId, + 'is_test' => TRUE, + )); + + $this->callAPISuccessGetCount('LineItem', array( + 'entity_id' => $membership['id'], + 'entity_table' => 'civicrm_membership', + 'contribution_id' => $contribution['id'], + ), 1); + + } + /** * Get a membership form object. *