public function associateWithCompany()
{
$dealId = $this->createDeal()->dealId;
$firstCompanyId = $this->createCompany();
$secondCompanyId = $this->createCompany();
$thirdCompanyId = $this->createCompany();
$response = $this->deals->associateWithCompany($dealId, [$firstCompanyId, $secondCompanyId, $thirdCompanyId]);
$this->assertSame(204, $response->getStatusCode());
//Check what was associated
$response = $this->deals->getById($dealId);
$associatedCompanies = $response->associations->associatedCompanyIds;
$expectedAssociatedCompanies = [$firstCompanyId, $secondCompanyId, $thirdCompanyId];
//sorting as order is not predicatable
sort($associatedCompanies);
sort($expectedAssociatedCompanies);
$this->assertEquals($expectedAssociatedCompanies, $associatedCompanies);
//Now disassociate
$response = $this->deals->disassociateFromCompany($dealId, [$firstCompanyId, $thirdCompanyId]);
$this->assertSame(204, $response->getStatusCode());
//Ensure that only one associated company left
$response = $this->deals->getById($dealId);
$this->assertSame([$secondCompanyId], $response->associations->associatedCompanyIds);
}