/**
* @test
*/
public function associateWithContact()
{
$dealId = $this->createDeal()->dealId;
$firstContactId = $this->createContact();
$secondContactId = $this->createContact();
$thirdContactId = $this->createContact();
$response = $this->deals->associateWithContact($dealId, [$firstContactId, $secondContactId, $thirdContactId]);
$this->assertSame(204, $response->getStatusCode());
//Check what was associated
$response = $this->deals->getById($dealId);
$associatedContacts = $response->associations->associatedVids;
$expectedAssociatedContacts = [$firstContactId, $secondContactId, $thirdContactId];
//sorting as order is not predicatable
sort($associatedContacts);
sort($expectedAssociatedContacts);
$this->assertEquals($expectedAssociatedContacts, $associatedContacts);
//Now disassociate
$response = $this->deals->disassociateFromContact($dealId, [$firstContactId, $thirdContactId]);
$this->assertSame(204, $response->getStatusCode());
//Ensure that only one associated contact left
$response = $this->deals->getById($dealId);
$this->assertSame([$secondContactId], $response->associations->associatedVids);
}