/** * Prepare attribute fixture. * * @return void */ protected function prepareAttribute() { $data = $this->attribute->getData(); if (isset($data['options'])) { $data['options'] = $this->prepareOptionsData($data['options']); } $data['attribute_id'] = $this->attributeEdit->getAttributeForm()->getAttributeId(); $this->attribute = $this->fixtureFactory->createByCode('catalogProductAttribute', ['data' => $data]); }
/** * Assert that displayed attribute data on edit page equals passed from fixture. * * @param CatalogProductAttributeIndex $catalogProductAttributeIndex * @param CatalogProductAttributeEdit $catalogProductAttributeEdit * @param CatalogProductAttribute $attribute * @return void */ public function processAssert(CatalogProductAttributeIndex $catalogProductAttributeIndex, CatalogProductAttributeEdit $catalogProductAttributeEdit, CatalogProductAttribute $attribute) { $filter = ['attribute_code' => $attribute->getAttributeCode()]; $catalogProductAttributeIndex->open()->getGrid()->searchAndOpen($filter); $dataFixture = $attribute->getData(); $dataForm = $catalogProductAttributeEdit->getAttributeForm()->getData($attribute); $errors = $this->verifyData($dataFixture, $dataForm); \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); }
/** * Assert that created attribute is displayed on product form. * * @param InjectableFixture $product * @param CatalogProduct $productGrid * @param CatalogProductEdit $productEdit * @param CatalogProductAttribute $attribute * @return void */ public function processAssert(InjectableFixture $product, CatalogProduct $productGrid, CatalogProductEdit $productEdit, CatalogProductAttribute $attribute) { $productGrid->open(); $productGrid->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]); \PHPUnit_Framework_Assert::assertTrue($productEdit->getProductForm()->checkAttributeLabel($attribute->getData()), "Product Attribute is absent on Product form."); }
/** * Run CreateAttributeSetEntity test. * * @param CatalogAttributeSet $attributeSet * @param CatalogProductAttribute $productAttribute * @return void */ public function test(CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttribute) { // Precondition $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(); }