}
public function testCreateLocBlock() {
- $email = civicrm_api('email', 'create', array(
- 'version' => $this->_apiversion,
+ $email = $this->callAPISuccess('email', 'create', array(
'contact_id' => 'null',
'location_type_id' => 1,
'email' => 'test@loc.block',
));
- $phone = civicrm_api('phone', 'create', array(
- 'version' => $this->_apiversion,
+ $phone = $this->callAPISuccess('phone', 'create', array(
'contact_id' => 'null',
'location_type_id' => 1,
'phone' => '1234567',
));
- $address = civicrm_api('address', 'create', array(
- 'version' => $this->_apiversion,
+ $address = $this->callAPISuccess('address', 'create', array(
'contact_id' => 'null',
'location_type_id' => 1,
'street_address' => '1234567',
));
$params = array(
- 'version' => $this->_apiversion,
'address_id' => $address['id'],
'phone_id' => $phone['id'],
'email_id' => $email['id'],
);
- $result = civicrm_api($this->_entity, 'create', $params);
+ $result = $this->callAPISuccess($this->_entity, 'create', $params);
$id = $result['id'];
$this->documentMe($params, $result, __FUNCTION__, __FILE__);
$this->assertAPISuccess($result, 'In line ' . __LINE__);
public function testCreateLocBlockEntities() {
$params = array(
- 'version' => $this->_apiversion,
'email' => array(
'location_type_id' => 1,
'email' => 'test2@loc.block',
'street_address' => '987654321',
),
);
- $result = civicrm_api($this->_entity, 'create', $params);
+ $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, 'Create entities and location block in 1 api call', NULL, 'createEntities');
$id = $result['id'];
- $this->documentMe($params, $result, __FUNCTION__, __FILE__, 'Create entities and location block in 1 api call', NULL, 'createEntities');
- $this->assertAPISuccess($result, 'In line ' . __LINE__);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
// Now check our results using the return param 'all'
'id' => $id,
'return' => 'all'
);
+ // Can't use callAPISuccess with getsingle
$result = civicrm_api($this->_entity, 'getsingle', $getParams);
$this->documentMe($getParams, $result, __FUNCTION__, __FILE__, 'Get entities and location block in 1 api call', NULL, 'get');
$this->assertNotNull($result['email_id'], 'In line ' . __LINE__);
$this->assertEquals($params['phone_2']['phone'], $result['phone_2']['phone'], 'In line ' . __LINE__);
$this->assertEquals($params['address']['street_address'], $result['address']['street_address'], 'In line ' . __LINE__);
// Delete block
- $result = civicrm_api($this->_entity, 'delete', array(
- 'version' => $this->_apiversion,
- 'id' => $id,
- ));
- $this->assertAPISuccess($result, 'In line ' . __LINE__);
+ $result = $this->callAPISuccess($this->_entity, 'delete', array('id' => $id));
}
public static function setUpBeforeClass() {