/**
  * @group ProductCategory
  *
  * @return void
  */
 public function testCreateAttributeTypeCreatesAndReturnsId()
 {
     $abstractSku = 'AnAbstractTestProduct';
     $concreteSku = 'ATestProduct';
     $categoryName = 'ATestCategory';
     $localeName = 'ABCDE';
     $abstractName = 'abstractName';
     $categoryKey = '100TEST';
     $locale = $this->localeFacade->createLocale($localeName);
     $productAbstractTransfer = new ProductAbstractTransfer();
     $productAbstractTransfer->setSku($abstractSku);
     $productAbstractTransfer->setAttributes([]);
     $localizedAttributes = new LocalizedAttributesTransfer();
     $localizedAttributes->setAttributes([]);
     $localizedAttributes->setLocale($locale);
     $localizedAttributes->setName($abstractName);
     $productAbstractTransfer->addLocalizedAttributes($localizedAttributes);
     $idProductAbstract = $this->productFacade->createProductAbstract($productAbstractTransfer);
     $productConcreteTransfer = new ProductConcreteTransfer();
     $productConcreteTransfer->setSku($concreteSku);
     $productConcreteTransfer->setAttributes([]);
     $productConcreteTransfer->addLocalizedAttributes($localizedAttributes);
     $productConcreteTransfer->setIsActive(true);
     $this->productFacade->createProductConcrete($productConcreteTransfer, $idProductAbstract);
     $categoryTransfer = new CategoryTransfer();
     $categoryTransfer->setName($categoryName);
     $categoryTransfer->setCategoryKey($categoryKey);
     $idCategory = $this->categoryFacade->createCategory($categoryTransfer, $locale);
     $categoryNodeTransfer = new NodeTransfer();
     $categoryNodeTransfer->setFkCategory($idCategory);
     $categoryNodeTransfer->setIsRoot(true);
     $this->categoryFacade->createCategoryNode($categoryNodeTransfer, $locale, false);
     $this->productCategoryFacade->createProductCategoryMapping($abstractSku, $categoryName, $locale);
     $this->assertTrue($this->productCategoryFacade->hasProductCategoryMapping($abstractSku, $categoryName, $locale));
 }
Esempio n. 2
0
 /**
  * @group Product
  *
  * @return void
  */
 public function testGetAbstractSkuFromProductConcrete()
 {
     $this->assertFalse($this->productFacade->hasProductConcrete(self::SKU_PRODUCT_CONCRETE));
     $productAbstract = new ProductAbstractTransfer();
     $productAbstract->setSku(self::SKU_PRODUCT_ABSTRACT);
     $productAbstract->setAttributes([]);
     $productAbstract->addLocalizedAttributes($this->createLocalizedAttributesTransfer());
     $idProductAbstract = $this->productFacade->createProductAbstract($productAbstract);
     $productConcrete = new ProductConcreteTransfer();
     $productConcrete->setSku(self::SKU_PRODUCT_CONCRETE);
     $productConcrete->setAttributes([]);
     $productConcrete->addLocalizedAttributes($this->createLocalizedAttributesTransfer());
     $productConcrete->setIsActive(true);
     $this->productFacade->createProductConcrete($productConcrete, $idProductAbstract);
     $this->assertTrue($this->productFacade->hasProductConcrete(self::SKU_PRODUCT_CONCRETE));
     $this->assertEquals($this->productFacade->getAbstractSkuFromProductConcrete(self::SKU_PRODUCT_CONCRETE), self::SKU_PRODUCT_ABSTRACT);
 }