* Test the duplicate check function.
*/
public function testDuplicateCheck() {
- $this->callAPISuccess('Contact', 'create', array(
+ $harry = array(
'first_name' => 'Harry',
'last_name' => 'Potter',
'email' => 'harry@hogwarts.edu',
'contact_type' => 'Individual',
- ));
+ );
+ $this->callAPISuccess('Contact', 'create', $harry);
$result = $this->callAPISuccess('Contact', 'duplicatecheck', array(
- 'match' => array(
- 'first_name' => 'Harry',
- 'last_name' => 'Potter',
- 'email' => 'harry@hogwarts.edu',
- 'contact_type' => 'Individual',
- ),
+ 'match' => $harry,
));
$this->assertEquals(1, $result['count']);
),
));
$this->assertEquals(0, $result['count']);
+ $this->callAPIFailure('Contact', 'create', array_merge($harry, array('dupe_check' => 1)));
}
public function testGetByContactType() {
$this->callAPISuccess('contact', 'delete', array('id' => $created_contact_id, 'skip_undelete' => TRUE));
}
+ public function testLoggedInUserAPISupportToken() {
+ $description = "Get contact id of the current logged in user";
+ $subFile = "ContactIDOfLoggedInUserContactAPI";
+ $cid = $this->createLoggedInUser();
+ $contact = $this->callAPIAndDocument('contact', 'get', array('id' => 'user_contact_id'), __FUNCTION__, __FILE__, $description, $subFile);
+ $this->assertEquals($cid, $contact['id']);
+ }
+
}