/**
  * Assert that product attribute is global.
  *
  * @param CatalogProductAttribute $attribute
  * @param CatalogProductAttributeIndex $attributeIndexPage
  * @return void
  */
 public function processAssert(CatalogProductAttribute $attribute, CatalogProductAttributeIndex $attributeIndexPage)
 {
     $attributeIndexPage->open();
     $code = $attribute->getAttributeCode();
     $filter = ['attribute_code' => $code, 'is_global' => $attribute->getIsGlobal()];
     \PHPUnit_Framework_Assert::assertTrue($attributeIndexPage->getGrid()->isRowVisible($filter), "Attribute with attribute code '{$code}' isn't global.");
 }
 /**
  * Check whether the attribute is unique.
  *
  * @param CatalogProductAttribute $attribute
  * @param CatalogProductAttributeNew $attributeNew
  * @param CatalogProductAttributeIndex $catalogProductAttributeIndex
  * @return void
  */
 public function processAssert(CatalogProductAttribute $attribute, CatalogProductAttributeNew $attributeNew, CatalogProductAttributeIndex $catalogProductAttributeIndex)
 {
     $catalogProductAttributeIndex->open();
     $catalogProductAttributeIndex->getPageActionsBlock()->addNew();
     $attributeNew->getAttributeForm()->fill($attribute);
     $attributeNew->getPageActions()->saveAndContinue();
     $actualMessage = $attributeNew->getMessagesBlock()->getErrorMessages();
     \PHPUnit_Framework_Assert::assertEquals(self::UNIQUE_MESSAGE, $actualMessage);
 }
 /**
  * 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);
 }
 /**
  * Fill attribute form on attribute new page.
  *
  * @return array
  */
 public function run()
 {
     $this->catalogProductAttributeIndex->open();
     $this->catalogProductAttributeIndex->getPageActionsBlock()->addNew();
     $this->attributeNew->getAttributeForm()->fill($this->attribute);
     $this->attributeNew->getPageActions()->saveAndContinue();
     $this->prepareAttribute();
     return ['attribute' => $this->attribute, 'templatesData' => ['attributes' => [$this->attribute]]];
 }
 /**
  * Assert that created product attribute exist in grid.
  *
  * @param CatalogProductAttribute $attribute
  * @param CatalogProductAttributeIndex $attributeIndexPage
  * @return void
  */
 public function processAssert(CatalogProductAttribute $attribute, CatalogProductAttributeIndex $attributeIndexPage)
 {
     $attributeIndexPage->open();
     $code = $attribute->getAttributeCode();
     \PHPUnit_Framework_Assert::assertTrue($attributeIndexPage->getGrid()->isRowVisible(['attribute_code' => $code]), 'Attribute with attribute code "' . $code . '" is absent in attribute grid.');
 }