protected function prepareCostCenter($name)
{
foreach ($this->sets[$name] as &$ccData) {
$ccData['accountId'] = self::$user->getAccountId();
$properties = [];
if (isset($ccData['properties'])) {
$properties = $ccData['properties'];
unset($ccData['properties']);
}
/* @var $cc CostCentreEntity */
$cc = ApiTest::createEntity(new CostCentreEntity(), $ccData);
$ccData['id'] = $cc->ccId;
if (isset($properties['billingCode'])) {
$cc->setProperty(CostCentrePropertyEntity::NAME_BILLING_CODE, $properties['billingCode']);
// to delete Cost Center properties
ApiTest::toDelete(CostCentrePropertyEntity::class, [$cc->ccId, $cc->getProperty(CostCentrePropertyEntity::NAME_BILLING_CODE)]);
}
}
}