Mostly replacing instances of callAPIAndDocument with callAPISuccess where they are overwriting
other test generated examples. I put this down to copy and paste
),
);
- $result = $this->callAPIAndDocument('Contact', 'create', $params, __FUNCTION__, __FILE__);
+ $result = $this->callAPISuccess('Contact', 'create', $params);
$customFldId = $result['values'][$result['id']]['api.CustomField.create']['id'];
$this->assertNotNull($result['id']);
$this->assertNotNull($customFldId);
'api.CustomValue.get' => 1,
);
- $result = $this->callAPIAndDocument('Contact', 'create', $params, __FUNCTION__, __FILE__);
+ $result = $this->callAPISuccess('Contact', 'create', $params);
$this->assertNotNull($result['id']);
$customFldDate = date("YmdHis", strtotime($result['values'][$result['id']]['api.CustomValue.get']['values'][0]['latest']));
$this->assertNotNull($customFldDate);
),
'api.CustomValue.get' => 1,
);
- $result = $this->callAPIAndDocument('Contact', 'create', $params, __FUNCTION__, __FILE__);
+ $result = $this->callAPISuccess('Contact', 'create', $params);
$this->assertNotNull($result['id']);
$customFldDate = date("Ymd", strtotime($result['values'][$result['id']]['api.CustomValue.get']['values'][0]['latest']));
$customFldTime = date("His", strtotime($result['values'][$result['id']]['api.CustomValue.get']['values'][0]['latest']));
$this->assertNotNull($customFldDate);
$this->assertEquals($dateTime, $customFldDate);
$this->assertEquals(000000, $customFldTime);
- $this->callAPIAndDocument('Contact', 'create', $params, __FUNCTION__, __FILE__);
+ $this->callAPISuccess('Contact', 'create', $params);
}
'api.Event.create' => $eventParams,
'sequential' => 1,
);
- $createResult = $this->callAPIAndDocument('LocBlock', 'create', $locBlockParams, __FUNCTION__, __FILE__);
+ $createResult = $this->callAPISuccess('LocBlock', 'create', $locBlockParams);
$locBlockId = $createResult['id'];
- $addressId = $createResult['values'][0]['address_id'];
$eventId = $createResult['values'][0]['api.Event.create']['id'];
// request the event with its loc block:
$params['event_type_id'] = 1;
$params['custom_' . $customField['id']] = "$contact_id";
- $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
+ $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
// Retrieve the activity, search for the contact.
$result = $this->callAPIAndDocument($this->_entity, 'get', array(
$this->assertArrayHasKey('id', $result['values'][$result['id']]);
$result = $this->callAPISuccess($this->_entity, 'Get', array('id' => $result['id']));
$this->callAPISuccess($this->_entity, 'Delete', array('id' => $result['id']));
- $this->assertEquals('2008-10-21 00:00:00', $result['values'][$result['id']]['start_date'], 'start date is not set in line ' . __LINE__);
- $this->assertEquals('2008-10-23 00:00:00', $result['values'][$result['id']]['end_date'], 'end date is not set in line ' . __LINE__);
- $this->assertEquals('2008-06-01 00:00:00', $result['values'][$result['id']]['registration_start_date'], 'start date is not set in line ' . __LINE__);
- $this->assertEquals('2008-10-15 00:00:00', $result['values'][$result['id']]['registration_end_date'], 'end date is not set in line ' . __LINE__);
+ $this->assertEquals('2008-10-21 00:00:00', $result['values'][$result['id']]['start_date'], 'start date is not set');
+ $this->assertEquals('2008-10-23 00:00:00', $result['values'][$result['id']]['end_date'], 'end date is not set');
+ $this->assertEquals('2008-06-01 00:00:00', $result['values'][$result['id']]['registration_start_date'], 'start date is not set');
+ $this->assertEquals('2008-10-15 00:00:00', $result['values'][$result['id']]['registration_end_date'], 'end date is not set');
}
/**
$params = array(
'id' => $this->_eventIds[0],
);
- $result = $this->callAPIAndDocument('Event', 'Delete', $params, __FUNCTION__, __FILE__);
+ $this->callAPIAndDocument('Event', 'Delete', $params, __FUNCTION__, __FILE__);
}
/**
*/
public function testDeleteWithExistingParticipant() {
$contactID = $this->individualCreate();
- $participantID = $this->participantCreate(
+ $this->participantCreate(
array(
'contactID' => $contactID,
'eventID' => $this->_eventIds[0],
)
);
- $result = $this->callAPISuccess('Event', 'Delete', array('id' => $this->_eventIds[0]));
+ $this->callAPISuccess('Event', 'Delete', array('id' => $this->_eventIds[0]));
}
public function testDeleteWithWrongEventId() {
$result = $this->callAPIFailure('Event', 'Delete', $params);
}
- ///////////////// civicrm_event_search methods
-
/**
* Test civicrm_event_search with wrong params type.
*/
);
// END SAMPLE DATA
- $create = $this->callAPIAndDocument('Mailing', 'create', $params, __FUNCTION__, __FILE__);
+ $create = $this->callAPISuccess('Mailing', 'create', $params);
$preview = $create['values'][$create['id']]['api.MailingRecipients.get'];
$this->assertEquals(1, $preview['count']);
* we can still have working click-trough URLs working (CRM-17959).
*/
public function testUrlWithMissingTrackingHash() {
- $mail = $this->callAPIAndDocument('mailing', 'create', $this->_params + array('scheduled_date' => 'now'), __FUNCTION__, __FILE__);
+ $mail = $this->callAPISuccess('mailing', 'create', $this->_params + array('scheduled_date' => 'now'), __FUNCTION__, __FILE__);
$jobs = $this->callAPISuccess('mailing_job', 'get', array('mailing_id' => $mail['id']));
$this->assertEquals(1, $jobs['count']);
$this->_params['body_text'] = str_replace("https://civicrm.org", $unicodeURL, $this->_params['body_text']);
$this->_params['body_html'] = str_replace("https://civicrm.org", $unicodeURL, $this->_params['body_html']);
- $mail = $this->callAPIAndDocument('mailing', 'create', $this->_params + array('scheduled_date' => 'now'), __FUNCTION__, __FILE__);
+ $mail = $this->callAPISuccess('mailing', 'create', $this->_params + array('scheduled_date' => 'now'));
$params = array('mailing_id' => $mail['id'], 'test_email' => 'alice@example.org', 'test_group' => NULL);
- $deliveredInfo = $this->callAPISuccess($this->_entity, 'send_test', $params);
+ $this->callAPISuccess($this->_entity, 'send_test', $params);
$sql = "SELECT turl.id as url_id, turl.url, q.id as queue_id
FROM civicrm_mailing_trackable_url as turl
);
}
- ///////////////// civicrm_payment_processor_add methods
-
/**
* Check with no name.
*/
$payProcParams = array(
'is_active' => 1,
);
- $result = $this->callAPIFailure('payment_processor', 'create', $payProcParams);
+ $this->callAPIFailure('payment_processor', 'create', $payProcParams);
}
/**
$params = $this->_params;
$result = $this->callAPIAndDocument('payment_processor', 'create', $params, __FUNCTION__, __FILE__);
$this->assertNotNull($result['id']);
-
- //assertDBState compares expected values in $result to actual values in the DB
$this->assertDBState('CRM_Financial_DAO_PaymentProcessor', $result['id'], $params);
return $result['id'];
}
$this->assertAPISuccess($result);
}
- ///////////////// civicrm_payment_processor_delete methods
-
/**
* Check payment processor delete.
*/
'id' => $id,
);
- $result = $this->callAPIAndDocument('payment_processor', 'delete', $params, __FUNCTION__, __FILE__);
+ $this->callAPIAndDocument('payment_processor', 'delete', $params, __FUNCTION__, __FILE__);
}
- ///////////////// civicrm_payment_processors_get methods
-
/**
* Check with valid params array.
*/
);
$results = $this->callAPISuccess('payment_processor', 'get', $params);
- $this->assertEquals(1, $results['count'], ' in line ' . __LINE__);
- $this->assertEquals('test@test.com', $results['values'][$results['id']]['user_name'], ' in line ' . __LINE__);
+ $this->assertEquals(1, $results['count']);
+ $this->assertEquals('test@test.com', $results['values'][$results['id']]['user_name']);
}
}
$checkCreated = $this->callAPISuccess($this->entity, 'get',
array('id' => $entity['id']));
$this->assertEquals(1, $checkCreated['count']);
- $result = $this->callAPIAndDocument('Pcp', 'delete',
+ $this->callAPIAndDocument('Pcp', 'delete',
array('id' => $entity['id']), __FUNCTION__, __FILE__);
$checkDeleted = $this->callAPISuccess($this->entity, 'get',
array('id' => $entity['id']));
$description = "Demonstrates get + delete in the same call.";
$subfile = 'ChainedGetDelete';
$params = array('title' => "Pcp title", 'api.Pcp.delete' => 1);
- $result = $this->callAPISuccess('Pcp', 'create', $this->params);
- $result = $this->callAPIAndDocument('Pcp', 'get', $params, __FUNCTION__,
+ $this->callAPISuccess('Pcp', 'create', $this->params);
+ $this->callAPIAndDocument('Pcp', 'get', $params, __FUNCTION__,
__FILE__, $description, $subfile);
$this->assertEquals(0, $this->callAPISuccess('Pcp', 'getcount', array()));
}
$params = array(
'contact_id' => 1,
);
- $result = $this->callAPIFailure('profile', 'get', $params,
+ $this->callAPIFailure('profile', 'get', $params,
'Mandatory key(s) missing from params array: profile_id'
);
}
'contribution_status_id' => 1,
);
- $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__);
+ $contribution = $this->callAPISuccess('contribution', 'create', $params);
$this->_ids['contributionId'] = $contribution['id'];
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 120.00);
),
);
- $description = "Create Contribution with Nested Line Items.";
- $subfile = "CreateWithNestedLineItems";
- $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
+ $contribution = $this->callAPISuccess('contribution', 'create', $params);
$lineItems = $this->callAPISuccess('line_item', 'get', array(
'entity_id' => $contribution['id'],
'source' => 'SSF',
'contribution_status_id' => 2,
);
- $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__);
+ $contribution = $this->callAPISuccess('contribution', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 120.00);
$this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID);
'contribution_status_id' => 2,
);
- $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__);
+ $contribution = $this->callAPISuccess('contribution', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 120.00);
$this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID);