/**
  * Assert check whether the attribute is used to create a configurable products
  *
  * @param CatalogProductAttribute $productAttribute
  * @param CatalogProductAttribute $attribute
  * @param CatalogProductIndex $productGrid
  * @param FixtureFactory $fixtureFactory
  * @param CatalogProductNew $newProductPage
  */
 public function processAssert(CatalogProductAttribute $attribute, CatalogProductIndex $productGrid, FixtureFactory $fixtureFactory, CatalogProductNew $newProductPage, CatalogProductAttribute $productAttribute = null)
 {
     $this->attribute = !is_null($productAttribute) ? $productAttribute : $attribute;
     $productGrid->open();
     $productGrid->getGridPageActionBlock()->addProduct('configurable');
     $productConfigurable = $fixtureFactory->createByCode('catalogProductConfigurable', ['dataSet' => 'default', 'data' => ['configurable_attributes_data' => ['preset' => 'one_variation', 'attributes' => [$this->attribute]]]]);
     $productBlockForm = $newProductPage->getForm();
     $productBlockForm->fill($productConfigurable);
     \PHPUnit_Framework_Assert::assertTrue($newProductPage->getForm()->findAttribute($this->attribute->getFrontendLabel()), "Product attribute is absent on the product page.");
 }
 /**
  * Assert that deleted attribute can't be added to product template on Product Page via Add Attribute control
  *
  * @param CatalogProductAttribute $productAttribute
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductNew $newProductPage
  * @param CatalogProductEdit $productEdit
  * @return void
  */
 public function processAssert(CatalogProductAttribute $productAttribute, CatalogProductIndex $productGrid, CatalogProductEdit $productEdit, CatalogProductNew $newProductPage)
 {
     $productGrid->open();
     $productGrid->getGridPageActionBlock()->addProduct('simple');
     $productEdit->getForm()->openVariationsTab();
     \PHPUnit_Framework_Assert::assertFalse($newProductPage->getForm()->checkAttributeInVariationsSearchAttributeForm($productAttribute), "Product attribute found in Attribute Search form.");
 }
 /**
  * Test create downloadable product
  *
  * @param CatalogProductDownloadable $product
  * @param CatalogCategory $category
  */
 public function testCreateDownloadableProduct(CatalogProductDownloadable $product, CatalogCategory $category)
 {
     $this->catalogProductIndex->open();
     $this->catalogProductIndex->getProductBlock()->addProduct('downloadable');
     $productBlockForm = $this->catalogProductNew->getForm();
     $productBlockForm->fillProduct($product, $category);
     $this->catalogProductNew->getFormAction()->save();
 }
 /**
  * Test create bundle product
  *
  * @param CatalogProductBundle $product
  * @param CatalogCategory $category
  * @return void
  */
 public function test(CatalogProductBundle $product, CatalogCategory $category)
 {
     $this->catalogProductIndex->open();
     $this->catalogProductIndex->getGridPageActionBlock()->addProduct('bundle');
     $productBlockForm = $this->catalogProductNew->getForm();
     $productBlockForm->fill($product, null, $category);
     $this->catalogProductNew->getFormAction()->save();
 }
 /**
  * Run create product virtual entity test
  *
  * @param CatalogProductVirtual $product
  * @param CatalogCategory $category
  * @return void
  */
 public function testCreate(CatalogProductVirtual $product, CatalogCategory $category)
 {
     // Steps
     $this->productGrid->open();
     $this->productGrid->getProductBlock()->addProduct('virtual');
     $productBlockForm = $this->newProductPage->getForm();
     $productBlockForm->fillProduct($product, $category);
     $this->newProductPage->getFormAction()->save();
 }
 /**
  * Run create product simple entity test
  *
  * @param CatalogProductSimple $product
  * @param CatalogCategory $category
  * @return void
  */
 public function testCreate(CatalogProductSimple $product, CatalogCategory $category)
 {
     // Steps
     $this->productGrid->open();
     $this->productGrid->getGridPageActionBlock()->addProduct('simple');
     $productBlockForm = $this->newProductPage->getForm();
     $productBlockForm->fill($product, null, $category);
     $this->newProductPage->getFormAction()->save();
 }
 /**
  * Assert that created product template:
  * 1. Displays in product template suggest container dropdown
  * 2. Can be used for new created product.
  *
  * @param FixtureFactory $fixtureFactory
  * @param CatalogProductEdit $productEdit
  * @param CatalogProductIndex $productGrid
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogProductNew $newProductPage
  * @param CatalogProductAttribute $productAttributeOriginal
  * @return void
  */
 public function processAssert(FixtureFactory $fixtureFactory, CatalogProductEdit $productEdit, CatalogProductIndex $productGrid, CatalogAttributeSet $attributeSet, CatalogProductNew $newProductPage, CatalogProductAttribute $productAttributeOriginal)
 {
     $productGrid->open();
     $productGrid->getGridPageActionBlock()->addProduct('simple');
     $productBlockForm = $newProductPage->getForm();
     /**@var CatalogProductSimple $catalogProductSimple */
     $productSimple = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'default', 'data' => ['attribute_set_id' => ['attribute_set' => $attributeSet]]]);
     $productBlockForm->fill($productSimple);
     \PHPUnit_Framework_Assert::assertTrue($productEdit->getForm()->isTabVisible($attributeSet->getGroup()), "Product Group is absent on Product form tabs.");
     $productEdit->getForm()->openCustomTab($attributeSet->getGroup());
     \PHPUnit_Framework_Assert::assertTrue($productEdit->getForm()->checkAttributeLabel($productAttributeOriginal), "Product Attribute is absent on Product form.");
 }
 /**
  * Assert that created product template:
  * 1. Displays in product template suggest container dropdown
  * 2. Can be used for new created product.
  *
  * @param FixtureFactory $fixtureFactory
  * @param CatalogProductEdit $productEdit
  * @param CatalogProductIndex $productGrid
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogProductNew $newProductPage
  * @param CatalogProductAttribute $productAttribute
  * @return void
  */
 public function processAssert(FixtureFactory $fixtureFactory, CatalogProductEdit $productEdit, CatalogProductIndex $productGrid, CatalogAttributeSet $attributeSet, CatalogProductNew $newProductPage, CatalogProductAttribute $productAttribute)
 {
     $productGrid->open();
     $productGrid->getProductBlock()->addProduct('simple');
     $productBlockForm = $newProductPage->getForm();
     /**@var CatalogProductSimple $catalogProductSimple */
     $productSimple = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'default', 'data' => ['attribute_set_id' => ['attribute_set' => $attributeSet]]]);
     $productBlockForm->fillProduct($productSimple);
     $newProductPage->getFormAction()->save();
     $formData = $productEdit->getForm()->getData($productSimple);
     $formAttributeSet = $formData['attribute_set_id'];
     \PHPUnit_Framework_Assert::assertEquals($attributeSet->getAttributeSetName(), $formAttributeSet, 'Attribute Set not found on Product form.' . "\nExpected: " . $attributeSet->getAttributeSetName() . "\nActual: " . $formAttributeSet);
     $productEdit->getForm()->openTab('product-details');
     \PHPUnit_Framework_Assert::assertTrue($productEdit->getForm()->checkAttributeLabel($productAttribute), "Product Attribute is absent on Product form.");
 }