/** * Assert that deleted attribute isn't displayed in Attribute set's Unassigned Attributes section * * @param CatalogAttributeSet $attributeSet * @param CatalogProductSetIndex $productSetIndex * @param CatalogProductSetEdit $productSetEdit * @return void */ public function processAssert(CatalogAttributeSet $attributeSet, CatalogProductSetIndex $productSetIndex, CatalogProductSetEdit $productSetEdit) { $filter = ['set_name' => $attributeSet->getAttributeSetName()]; $productSetIndex->open(); $productSetIndex->getGrid()->searchAndOpen($filter); $attributeCode = $attributeSet->getDataFieldConfig('assigned_attributes')['source']->getAttributes()[0]->getAttributeCode(); \PHPUnit_Framework_Assert::assertFalse($productSetEdit->getAttributeSetEditBlock()->checkUnassignedProductAttribute($attributeCode), "Attribute " . $attributeCode . " is present in Unassigned Attribute set's section."); }
/** * Assert that deleted attribute can't be mapped to Google Attribute (attribute doesn't appear in Attributes * Mapping -> Google Content - Attributes after selecting attribute set) * * @param FixtureFactory $fixtureFactory * @param CatalogAttributeSet $productTemplate * @param GoogleShoppingTypesIndex $shoppingTypesIndex * @param GoogleShoppingTypesNew $shoppingTypesNew * @return void */ public function processAssert(FixtureFactory $fixtureFactory, CatalogAttributeSet $productTemplate, GoogleShoppingTypesIndex $shoppingTypesIndex, GoogleShoppingTypesNew $shoppingTypesNew) { $shoppingTypesIndex->open(); $shoppingTypesIndex->getPageActionsBlock()->addNew(); $shoppingAttributes = $fixtureFactory->createByCode('googleShoppingAttribute', ['dataSet' => 'default', 'data' => ['attribute_set_id' => ['attribute_set' => $productTemplate]]]); $shoppingTypesNew->getGoogleShoppingForm()->fill($shoppingAttributes); $shoppingTypesNew->getGoogleShoppingForm()->clickAddNewAttribute(); $attributeCode = $productTemplate->getDataFieldConfig('assigned_attributes')['source']->getAttributes()[0]->getAttributeCode(); \PHPUnit_Framework_Assert::assertFalse($shoppingTypesNew->getGoogleShoppingForm()->findAttribute($attributeCode), "Attribute " . $attributeCode . " is present in Attribute set mapping"); }
/** * Run DeleteAssignedToTemplateProductAttribute test * * @param CatalogAttributeSet $productTemplate * @return array */ public function test(CatalogAttributeSet $productTemplate) { // Precondition $productTemplate->persist(); // Steps $filter = ['attribute_code' => $productTemplate->getDataFieldConfig('assigned_attributes')['source']->getAttributes()[0]->getAttributeCode()]; $this->attributeIndex->open(); $this->attributeIndex->getGrid()->searchAndOpen($filter); $this->attributeNew->getPageActions()->delete(); return ['productTemplate' => $productTemplate]; }
/** * Run test. * * @param CatalogAttributeSet $attributeSet * @return array */ public function test(CatalogAttributeSet $attributeSet) { // Precondition $attributeSet->persist(); $attribute = $attributeSet->getDataFieldConfig('assigned_attributes')['source']->getAttributes()[0]; // Steps $filter = ['attribute_code' => $attribute->getAttributeCode()]; $this->attributeIndex->open(); $this->attributeIndex->getGrid()->searchAndOpen($filter); $this->attributeNew->getPageActions()->delete(); $this->attributeNew->getModalBlock()->acceptAlert(); return ['attributeSet' => $attributeSet, 'attribute' => $attribute]; }
/** * Create Attribute Set * * @param CatalogAttributeSet $fixture * @return string */ protected function createAttributeSet(CatalogAttributeSet $fixture) { $data = $fixture->getData(); if (!isset($data['gotoEdit'])) { $data['gotoEdit'] = 1; } $data['skeleton_set'] = $fixture->getDataFieldConfig('skeleton_set')['source']->getAttributeSet()->getAttributeSetId(); $url = $_ENV['app_backend_url'] . 'catalog/product_set/save/'; $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); $curl->addOption(CURLOPT_HEADER, 1); $curl->write($url, $data); $response = $curl->read(); $curl->close(); return $response; }