));
$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,
+ ));
+
+ // CRM-16992.
+ $this->callAPISuccessGetCount('LineItem', array(
+ 'entity_id' => $membership['id'],
+ 'entity_table' => 'civicrm_membership',
+ 'contribution_id' => $contribution['id'],
+ ), 1);
+ }
+
+ /**
+ * Get a membership form object.
+ *
+ * We need to instantiate the form to run preprocess, which means we have to trick it about the request method.
+ *
+ * @return \CRM_Member_Form_Membership
+ */
+ protected function getForm() {
+ $form = new CRM_Member_Form_Membership();
+ $_SERVER['REQUEST_METHOD'] = 'GET';
+ $form->controller = new CRM_Core_Controller();
+ $form->_bltID = 5;
+ return $form;
+ }
+
+ /**
+ * @return array
+ */
+ protected function getBaseSubmitParams() {
$params = array(
'cid' => $this->_individualId,
'price_set_id' => 0,
'billing_postal_code-5' => '90210',
'billing_country_id-5' => '1228',
);
- $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,
- ));
- // Not currently passing.
- // $this->callAPISuccessGetCount('LineItem', array(
- // 'entity_id' => $membership['id'],
- // 'entity_table' => 'civicrm_membership',
- // 'contribution_id' => $contribution['id'],
- //), 1);
- //
- }
-
- /**
- * Get a membership form object.
- *
- * We need to instantiate the form to run preprocess, which means we have to trick it about the request method.
- *
- * @return \CRM_Member_Form_Membership
- */
- protected function getForm() {
- $form = new CRM_Member_Form_Membership();
- $_SERVER['REQUEST_METHOD'] = 'GET';
- $form->controller = new CRM_Core_Controller();
- $form->_bltID = 5;
- return $form;
+ return $params;
}
}