), 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.
*