/** * Move attribute To attribute set. * * @return array */ public function run() { $filterAttribute = ['set_name' => $this->attributeSet->getAttributeSetName()]; $this->catalogProductSetIndex->open()->getGrid()->searchAndOpen($filterAttribute); $this->catalogProductSetEdit->getAttributeSetEditBlock()->moveAttribute($this->attribute->getData()); $this->catalogProductSetEdit->getPageActions()->save(); }
/** * Run CreateAttributeSetEntity test * * @param CatalogAttributeSet $attributeSet * @param CatalogProductAttribute $productAttribute * @return void */ public function testCreateAttributeSet(CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttribute) { $productAttribute->persist(); //Steps $this->productSetIndex->open(); $this->productSetIndex->getPageActionsBlock()->addNew(); $this->productSetAdd->getAttributeSetForm()->fill($attributeSet); $this->productSetAdd->getPageActions()->save(); $this->productSetEdit->getAttributeSetEditBlock()->moveAttribute($productAttribute->getData()); $this->productSetEdit->getPageActions()->save(); }
/** * Move attribute To attribute set. * * @return array */ public function run() { $filterAttribute = ['set_name' => $this->productTemplate->getAttributeSetName()]; $this->catalogProductSetIndex->open()->getGrid()->searchAndOpen($filterAttribute); $this->catalogProductSetEdit->getAttributeSetEditBlock()->moveAttribute($this->attribute->getData()); $this->catalogProductSetEdit->getPageActions()->save(); // Create product with attribute set mentioned above: $product = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'product_with_category_with_anchor', 'data' => ['attribute_set_id' => ['attribute_set' => $this->productTemplate]]]); $product->persist(); return ['product' => $product]; }
/** * Run DeleteAttributeSet test * * @param FixtureFactory $fixtureFactory * @param CatalogAttributeSet $productTemplate * @return array */ public function test(FixtureFactory $fixtureFactory, CatalogAttributeSet $productTemplate) { // Precondition $productTemplate->persist(); $product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'default', 'data' => ['attribute_set_id' => ['attribute_set' => $productTemplate]]]); $product->persist(); // Steps $filter = ['set_name' => $productTemplate->getAttributeSetName()]; $this->productSetIndex->open(); $this->productSetIndex->getGrid()->searchAndOpen($filter); $this->productSetEdit->getPageActions()->delete(); return ['product' => $product]; }
/** * Run UpdateProductTemplate test * * @param CatalogAttributeSet $attributeSet * @param CatalogAttributeSet $attributeSetOriginal * @param CatalogProductAttribute $productAttributeOriginal * @return void */ public function test(CatalogAttributeSet $attributeSet, CatalogAttributeSet $attributeSetOriginal, CatalogProductAttribute $productAttributeOriginal) { // Precondition $attributeSetOriginal->persist(); $productAttributeOriginal->persist(); // Steps $filter = ['set_name' => $attributeSetOriginal->getAttributeSetName()]; $this->productSetIndex->open(); $this->productSetIndex->getGrid()->searchAndOpen($filter); $groupName = $attributeSet->getGroup(); $this->productSetEdit->getAttributeSetEditBlock()->addAttributeSetGroup($groupName); $this->productSetEdit->getAttributeSetEditBlock()->moveAttribute($productAttributeOriginal->getData(), $groupName); $this->productSetEdit->getAttributeSetEditForm()->fill($attributeSet); $this->productSetEdit->getPageActions()->save(); }
/** * Add this attribute to Default attribute Template. Create product and Assert that created attribute * is displayed on product form (Products > Inventory > Catalog) * * @param FixtureFactory $fixtureFactory * @param CatalogProductSetIndex $productSet * @param CatalogProductSetEdit $productSetEdit * @param CatalogAttributeSet $productTemplate * @param CatalogProductIndex $productGrid * @param CatalogProductAttribute $productAttributeOriginal * @param CatalogProductEdit $productEdit * @param CatalogProductAttribute|null $productAttribute * @return void */ public function processAssert(FixtureFactory $fixtureFactory, CatalogProductSetIndex $productSet, CatalogProductSetEdit $productSetEdit, CatalogAttributeSet $productTemplate, CatalogProductIndex $productGrid, CatalogProductEdit $productEdit, CatalogProductAttribute $productAttribute, CatalogProductAttribute $productAttributeOriginal = null) { $filterAttribute = ['set_name' => $productTemplate->getAttributeSetName()]; $productSet->open(); $productSet->getGrid()->searchAndOpen($filterAttribute); $attributeData = $productAttributeOriginal !== null ? array_merge($productAttribute->getData(), $productAttributeOriginal->getData()) : $productAttribute->getData(); $productSetEdit->getAttributeSetEditBlock()->moveAttribute($attributeData, 'Product Details'); $productSetEdit->getPageActions()->save(); $product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category', 'data' => ['attribute_set_id' => ['attribute_set' => $productTemplate]]]); $product->persist(); $filterProduct = ['sku' => $product->getSku()]; $productGrid->open(); $productGrid->getProductGrid()->searchAndOpen($filterProduct); $catalogProductAttribute = $productAttributeOriginal !== null ? array_merge($productAttributeOriginal->getData(), $productAttribute->getData()) : $productAttribute->getData(); \PHPUnit_Framework_Assert::assertTrue($productEdit->getProductForm()->checkAttributeLabel($catalogProductAttribute), "Product Attribute is absent on Product form."); }
/** * Move attribute To attribute set. * * @return array */ public function run() { $filterAttribute = ['set_name' => $this->attributeSet->getAttributeSetName()]; $this->catalogProductSetIndex->open()->getGrid()->searchAndOpen($filterAttribute); $this->catalogProductSetEdit->getAttributeSetEditBlock()->moveAttribute($this->attribute->getData()); $this->catalogProductSetEdit->getPageActions()->save(); // Create product with attribute set mentioned above: $customAttribute = $this->attribute; if ($this->attributeValue !== null) { $customAttribute = ['value' => $this->attributeValue, 'attribute' => $customAttribute]; } $product = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'product_with_category_with_anchor', 'data' => ['attribute_set_id' => ['attribute_set' => $this->attributeSet], 'custom_attribute' => $customAttribute]]); $this->catalogProductIndex->open()->getGridPageActionBlock()->addProduct('simple'); $productForm = $this->catalogProductEdit->getProductForm(); $productForm->fill($product); $this->catalogProductEdit->getFormPageActions()->save(); return ['product' => $product]; }
/** * Save attributeSet on attribute set page. * * @return void */ public function run() { $this->catalogProductSetEdit->getPageActions()->save(); }