/** * Handle family creation. * * @param array $item * * @throws InvalidItemException */ protected function handleNewFamily(array $item) { if (isset($item['families_to_create'])) { $pimFamily = $item['family_object']; $magentoFamilyId = $this->webservice->createAttributeSet($item['families_to_create']['attributeSetName']); $magentoUrl = $this->getSoapUrl(); $this->familyMappingManager->registerFamilyMapping($pimFamily, $magentoFamilyId, $magentoUrl); $this->stepExecution->incrementSummaryInfo('family_created'); } }
function it_increments_summary_info_with_family_exists_if_it_exists($webservice, $stepExecution, Family $family, FamilyMappingManager $familyMappingManager) { $batches = [['families_to_create' => ['attributeSetName' => 'family_code'], 'family_object' => $family]]; $webservice->createAttributeSet('family_code')->willThrow('\\Pim\\Bundle\\MagentoConnectorBundle\\Webservice\\SoapCallException'); $familyMappingManager->registerFamilyMapping(Argument::cetera())->shouldNotBeCalled(); $stepExecution->incrementSummaryInfo('family_exists')->shouldBeCalled(); $this->write($batches); }