function let(WebserviceGuesser $webserviceGuesser, FamilyMappingManager $familyMappingManager, AttributeMappingManager $attributeMappingManager, AttributeGroupMappingManager $attributeGroupMappingManager, Webservice $webservice, StepExecution $stepExecution, MagentoMappingMerger $magentoMappingMerger, MagentoSoapClientParametersRegistry $clientParametersRegistry, MagentoSoapClientParameters $clientParameters)
 {
     $clientParametersRegistry->getInstance(null, null, null, '/api/soap/?wsdl', 'default', null, null)->willReturn($clientParameters);
     $webserviceGuesser->getWebservice($clientParameters)->willReturn($webservice);
     $this->beConstructedWith($webserviceGuesser, $familyMappingManager, $attributeMappingManager, $attributeGroupMappingManager, $magentoMappingMerger, $clientParametersRegistry);
     $this->setStepExecution($stepExecution);
 }
 function let(WebserviceGuesser $webserviceGuesser, Webservice $webservice, StepExecution $stepExecution, MagentoSoapClientParametersRegistry $clientParametersRegistry, MagentoSoapClientParameters $clientParameters)
 {
     $clientParametersRegistry->getInstance(null, null, null, '/api/soap/?wsdl', 'default', null, null)->willReturn($clientParameters);
     $webserviceGuesser->getWebservice($clientParameters)->willReturn($webservice);
     $this->beConstructedWith($webserviceGuesser, $clientParametersRegistry);
     $this->setStepExecution($stepExecution);
 }
 /**
  * Get all sources
  *
  * @return array
  */
 public function getAllTargets()
 {
     $sources = [];
     if ($this->isValid()) {
         $attributeCodes = array_keys($this->webserviceGuesser->getWebservice($this->clientParameters)->getAllAttributes());
         foreach ($attributeCodes as $attributeCode) {
             $sources[] = ['id' => $attributeCode, 'text' => $attributeCode];
         }
     }
     return $sources;
 }
 /**
  * {@inheritdoc}
  */
 public function getAllTargets()
 {
     $targets = [];
     if ($this->isValid()) {
         $storeViews = $this->webserviceGuesser->getWebservice($this->clientParameters)->getStoreViewsList();
         foreach ($storeViews as $storeView) {
             if ($storeView['code'] !== $this->defaultStoreView) {
                 $targets[] = ['id' => $storeView['code'], 'text' => $storeView['code']];
             }
         }
     }
     return $targets;
 }
 /**
  * Get mapping
  *
  * @return array
  */
 public function getMapping()
 {
     $mapping = new MappingCollection();
     if ($this->isValid()) {
         try {
             $attributes = $this->webserviceGuesser->getWebservice($this->clientParameters)->getAllAttributes();
         } catch (SoapCallException $e) {
             return $mapping;
         }
         foreach ($attributes as $attribute) {
             $mapping->add(['source' => $attribute['code'], 'target' => $attribute['attribute_id'], 'deletable' => true]);
         }
     }
     return $mapping;
 }
 /**
  * {@inheritdoc}
  */
 public function getAllTargets()
 {
     $targets = [];
     if ($this->isValid()) {
         try {
             $families = $this->webserviceGuesser->getWebservice($this->clientParameters)->getAttributeSetList();
         } catch (SoapCallException $e) {
             return array();
         }
         foreach ($families as $familyId => $family) {
             $targets[] = ['id' => $familyId, 'name' => $family['name']];
         }
     }
     return $targets;
 }
 /**
  * Function called before all item step execution
  */
 protected function beforeExecute()
 {
     if ($this->beforeExecute) {
         return;
     }
     $this->beforeExecute = true;
     $this->webservice = $this->webserviceGuesser->getWebservice($this->getClientParameters());
 }
 /**
  * Get all targets
  * @return array
  */
 public function getAllTargets()
 {
     $targets = [];
     if ($this->isValid()) {
         try {
             $categories = $this->webserviceGuesser->getWebservice($this->clientParameters)->getCategoriesStatus();
         } catch (SoapCallException $e) {
             return array();
         }
         foreach ($categories as $categoryId => $category) {
             if ($categoryId != self::ROOT_CATEGORY_ID) {
                 $targets[] = ['id' => $categoryId, 'text' => $category['name']];
             }
         }
     }
     return $targets;
 }
 /**
  * Are the given parameters valid ?
  *
  * @param MagentoSoapClientParameters $clientParameters
  *
  * @return boolean
  */
 public function areValidSoapCredentials(MagentoSoapClientParameters $clientParameters)
 {
     if (null === $clientParameters->isValid()) {
         try {
             $this->urlExplorer->getUrlContent($clientParameters);
             $webservice = $this->webserviceGuesser->getWebservice($clientParameters);
             $webservice->getStoreViewsList();
             $clientParameters->setValidation(true);
         } catch (\Exception $e) {
             $clientParameters->setValidation(false);
         }
     }
     return $clientParameters->isValid();
 }
 function it_associates_only_products_in_channel_to_configurable($clientParametersRegistry, $normalizerGuesser, $groupManager, $channelManager, $productFilter, Group $group, Channel $channel, ProductInterface $product1, ProductInterface $product2, ProductInterface $product3, MagentoSoapClientParameters $clientParameters, WebserviceGuesser $webserviceGuesser, Webservice $webservice, ProductNormalizer $productNormalizer, ConfigurableNormalizer $configurableNormalizer, GroupRepository $groupRepository, StepExecution $stepExecution, EventDispatcher $eventDispatcher)
 {
     $clientParametersRegistry->getInstance(Argument::cetera())->willReturn($clientParameters);
     $webserviceGuesser->getWebservice($clientParameters)->willReturn($webservice);
     $normalizerGuesser->getProductNormalizer(Argument::cetera())->willReturn($productNormalizer);
     $normalizerGuesser->getConfigurableNormalizer(Argument::cetera())->willReturn($configurableNormalizer);
     $webservice->getStoreViewsList()->willReturn([['store_id' => '1', 'code' => 'default', 'website_id' => '1', 'group_id' => '1', 'name' => 'Default Store View', 'sort_order' => '0', 'is_active' => '1']]);
     $webservice->getAllAttributes()->willReturn(['name' => ['attribute_id' => '71', 'code' => 'name', 'type' => 'text', 'required' => '1', 'scope' => 'store']]);
     $webservice->getAllAttributesOptions()->willReturn([]);
     $webservice->getConfigurablesStatus([1 => ['group' => $group, 'products' => [$product1, $product2]]])->willReturn([['product_id' => '6', 'sku' => 'conf-groupCode', 'name' => 'foo', 'set' => '3', 'type' => 'configurable', 'category_ids' => ['7'], 'website_ids' => ['1']]]);
     $groupManager->getRepository()->willReturn($groupRepository);
     $groupRepository->getVariantGroupIds()->willReturn([1]);
     $channelManager->getChannelByCode('magento')->willReturn($channel);
     $channel->getId()->willReturn(3);
     $group->getId()->willReturn(1);
     $group->getProducts()->willReturn([$product1, $product2, $product3]);
     $group->getCode()->willReturn('groupCode');
     $product1->getGroups()->willReturn([$group]);
     $product1->getId()->willReturn(10);
     $product2->getId()->willReturn(11);
     $product3->getId()->willReturn(12);
     $productFilter->apply($channel, [$product1, $product2, $product3])->willReturn([$product1, $product2]);
     $configurableNormalizer->normalize(['group' => $group, 'products' => [$product1, $product2]], 'MagentoArray', Argument::type('array'))->shouldBeCalled();
     $this->setStepExecution($stepExecution);
     $this->setEventDispatcher($eventDispatcher);
     $this->setChannel('magento');
     $this->process([$product1]);
 }