Skip to content

Commit

Permalink
(NFC) Add unit test of creating notes from the contact.create API
Browse files Browse the repository at this point in the history
  • Loading branch information
seamuslee001 committed Jan 16, 2019
1 parent 1ce4df2 commit 84736eb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/phpunit/api/v3/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3902,4 +3902,30 @@ public function testSmartGroupsForRelatedContacts() {
$this->assertTrue($g3Contacts['count'] == 1);
}

/**
* Test that getquick returns contacts with an exact first name match first.
*/
public function testCreateNoteinCreate() {
$loggedInContactID = $this->createLoggedInUser();
$this->_params['note'] = "Test note created by API Call as a String";
$contact = $this->callAPISuccess('Contact', 'create', $this->_params);
$note = $this->callAPISuccess('Note', 'get', ['contact_id' => $loggedInContactID]);
$this->assertEquals($note['values'][$note['id']]['note'], "Test note created by API Call as a String");
$note = $this->callAPISuccess('Note', 'get', ['entity_id' => $contact['id']]);
$this->assertEquals($note['values'][$note['id']]['note'], "Test note created by API Call as a String");
}

/**
* Test that getquick returns contacts with an exact first name match first.
*/
public function testCreateNoteinCreateArrayFormat() {
$contact1 = $this->callAPISuccess('Contact', 'create', array('first_name' => 'Alan', 'last_name' => 'MouseMouse', 'contact_type' => 'Individual'));
$this->_params['note'] = [['note' => "Test note created by API Call as array", 'contact_id' => $contact1['id']]];
$contact2 = $this->callAPISuccess('Contact', 'create', $this->_params);
$note = $this->callAPISuccess('Note', 'get', ['contact_id' => $contact1['id']]);
$this->assertEquals($note['values'][$note['id']]['note'], "Test note created by API Call as array");
$note = $this->callAPISuccess('Note', 'get', ['entity_id' => $contact2['id']]);
$this->assertEquals($note['values'][$note['id']]['note'], "Test note created by API Call as array");
}

}

0 comments on commit 84736eb

Please sign in to comment.