本文整理汇总了PHP中Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit类的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductEdit类的具体用法?PHP CatalogProductEdit怎么用?PHP CatalogProductEdit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CatalogProductEdit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* 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.");
}
示例2: processAssert
/**
* Assert that video data received from external service is correct.
*
* @param CatalogProductEdit $editProductPage
* @param InjectableFixture $initialProduct
* @param array $video
* @return void
*/
public function processAssert(CatalogProductEdit $editProductPage, InjectableFixture $initialProduct, array $video)
{
$editProductPage->open(['id' => $initialProduct->getId()]);
$editProductPage->getProductForm()->openTab('images-and-videos');
$imagesTab = $editProductPage->getProductForm()->getTab('images-and-videos');
$result = $imagesTab->clickFirstVideo()->getVideoDialog()->validate($video);
\PHPUnit_Framework_Assert::assertTrue($result, 'Video data received from external service is not correct.');
}
示例3: processAssert
/**
* Assert form data equals fixture data
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$filter = ['sku' => $product->getData('sku')];
$productGrid->open()->getProductGrid()->searchAndOpen($filter);
$fields = $this->convertDownloadableArray($this->prepareFixtureData($product));
$fieldsForm = $productPage->getForm()->getData($product);
\PHPUnit_Framework_Assert::assertEquals($fields, $fieldsForm, 'Form data not equals fixture data.');
}
示例4: processAssert
/**
* Assert that video data received from external service is correct.
*
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $editProductPage
* @param InjectableFixture $product
* @param array $video
* @return void
*/
public function processAssert(CatalogProductIndex $productGrid, CatalogProductEdit $editProductPage, InjectableFixture $product, array $video)
{
$productGrid->open();
$productGrid->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
$editProductPage->getProductForm()->openSection('images-and-videos');
$imagesTab = $editProductPage->getProductForm()->getSection('images-and-videos');
$result = $imagesTab->clickFirstVideo()->getVideoDialog()->validate($video);
\PHPUnit_Framework_Assert::assertTrue($result, 'Video data received from external service is not correct.');
}
示例5: processAssert
/**
* Assert form data equals fixture data
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$filter = ['sku' => $product->getSku()];
$productGrid->open()->getProductGrid()->searchAndOpen($filter);
$formData = $productPage->getForm()->getData($product);
$fixtureData = $this->prepareFixtureData($product);
$errors = $this->compareArray($fixtureData, $formData);
\PHPUnit_Framework_Assert::assertTrue(empty($errors), "These data must be equal to each other:\n" . implode("\n", $errors));
}
示例6: processAssert
/**
* Assert form data equals fixture data.
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$filter = ['sku' => $product->getSku() . '-1'];
$productGrid->open()->getProductGrid()->searchAndOpen($filter);
$formData = $productPage->getProductForm()->getData($product);
$fixtureData = $this->prepareFixtureData($product->getData());
$errors = $this->verifyData($fixtureData, $formData);
\PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
}
示例7: processAssert
/**
* Check whether the attribute is mandatory.
*
* @param CatalogProductIndex $catalogProductIndex
* @param CatalogProductEdit $catalogProductEdit
* @param CatalogProductAttribute $attribute
* @param InjectableFixture $product
* @return void
*/
public function processAssert(CatalogProductIndex $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, InjectableFixture $product)
{
$catalogProductIndex->open()->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
$productForm = $catalogProductEdit->getProductForm();
$productForm->getAttributeElement($attribute)->setValue('');
$catalogProductEdit->getFormPageActions()->save();
$failedAttributes = $productForm->getRequireNoticeAttributes($product);
$actualMessage = $failedAttributes['product-details'][$attribute->getFrontendLabel()];
\PHPUnit_Framework_Assert::assertEquals(self::REQUIRE_MESSAGE, $actualMessage, 'JS error notice on product edit page is not equal to expected.');
}
示例8: processAssert
/**
* Assert form data equals fixture data
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$filter = ['sku' => $product->getSku()];
$productGrid->open()->getProductGrid()->searchAndOpen($filter);
$fieldsForm = $productPage->getProductForm()->getData($product);
$fieldsFixture = $this->prepareFixtureData($product->getData());
$fieldsFixture['associated'] = $this->prepareGroupedOptions($fieldsFixture['associated']);
$errors = $this->verifyData($fieldsFixture, $fieldsForm);
\PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
}
示例9: processAssert
/**
* Check whether the attribute is unique.
*
* @param CatalogProductIndex $catalogProductIndex
* @param CatalogProductEdit $catalogProductEdit
* @param CatalogProductAttribute $attribute
* @param CatalogProductSimple $product,
* @param FixtureFactory $fixtureFactory
* @throws \Exception
* @return void
*/
public function processAssert(CatalogProductIndex $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, CatalogProductSimple $product, FixtureFactory $fixtureFactory)
{
$simpleProduct = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category_with_anchor', 'data' => ['attribute_set_id' => ['attribute_set' => $product->getDataFieldConfig('attribute_set_id')['source']->getAttributeSet()], 'custom_attribute' => $attribute]]);
$catalogProductIndex->open()->getGridPageActionBlock()->addProduct('simple');
$productForm = $catalogProductEdit->getProductForm();
$productForm->fill($simpleProduct);
$catalogProductEdit->getFormPageActions()->save();
$failedAttributes = $productForm->getRequireNoticeAttributes($simpleProduct);
$actualMessage = isset($failedAttributes['product-details'][$attribute->getFrontendLabel()]) ? $failedAttributes['product-details'][$attribute->getFrontendLabel()] : null;
\PHPUnit_Framework_Assert::assertEquals(sprintf(self::UNIQUE_MESSAGE, $attribute->getFrontendLabel()), $actualMessage, 'JS error notice on product edit page is not equal to expected.');
}
示例10: processAssert
/**
* Add this attribute to Default attribute Template. Create product and Assert that created attribute
* is displayed on product form (Products > Inventory > Catalog).
*
* @param InjectableFixture $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productEdit
* @param CatalogProductAttribute $attribute
* @param CatalogAttributeSet $attributeSet
* @param CatalogProductAttribute $productAttributeOriginal
* @throws \Exception
* @return void
*/
public function processAssert(InjectableFixture $product, CatalogProductIndex $productGrid, CatalogProductEdit $productEdit, CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttributeOriginal = null)
{
if (!$product->hasData('sku')) {
$product = $this->createProductWithAttributeSet($productAttributeOriginal, $attributeSet);
}
$filterProduct = ['sku' => $product->getSku()];
$productGrid->open();
$productGrid->getProductGrid()->searchAndOpen($filterProduct);
$catalogProductAttribute = $productAttributeOriginal !== null ? array_merge($productAttributeOriginal->getData(), $attribute->getData()) : $attribute->getData();
\PHPUnit_Framework_Assert::assertTrue($productEdit->getProductForm()->checkAttributeLabel($catalogProductAttribute), "Product Attribute is absent on Product form.");
}
示例11: processAssert
/**
* 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->getProductForm();
/**@var CatalogProductSimple $catalogProductSimple */
$productSimple = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'default', 'data' => ['attribute_set_id' => ['attribute_set' => $attributeSet]]]);
$productBlockForm->fill($productSimple);
\PHPUnit_Framework_Assert::assertTrue($productEdit->getProductForm()->isCustomTabVisible($attributeSet->getGroup()), "Product Group is absent on Product form tabs.");
$productEdit->getProductForm()->openCustomTab($attributeSet->getGroup());
\PHPUnit_Framework_Assert::assertTrue($productEdit->getProductForm()->checkAttributeLabel($productAttributeOriginal), "Product Attribute is absent on Product form.");
}
示例12: processAssert
/**
* Check whether the attribute is unique.
*
* @param CatalogProductIndex $catalogProductIndex
* @param CatalogProductEdit $catalogProductEdit
* @param CatalogProductAttribute $attribute
* @param CatalogProductSimple $product ,
* @param FixtureFactory $fixtureFactory
* @throws \Exception
* @return void
*/
public function processAssert(CatalogProductIndex $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, CatalogProductSimple $product, FixtureFactory $fixtureFactory)
{
$this->fixtureFactory = $fixtureFactory;
$simpleProduct = $this->createSimpleProductFixture($product, $attribute);
$catalogProductIndex->open()->getGridPageActionBlock()->addProduct('simple');
$productForm = $catalogProductEdit->getProductForm();
$productForm->fill($simpleProduct);
$catalogProductEdit->getFormPageActions()->save();
$actualErrorMessage = $catalogProductEdit->getMessagesBlock()->getErrorMessage();
$attributeLabel = $attribute->getFrontendLabel();
\PHPUnit_Framework_Assert::assertEquals(sprintf(self::UNIQUE_MESSAGE, $attributeLabel), $actualErrorMessage, 'JS error notice on product edit page is not equal to expected.');
}
示例13: processAssert
/**
* Check whether the attribute is mandatory.
*
* @param CatalogProductIndex $catalogProductIndex
* @param CatalogProductEdit $catalogProductEdit
* @param CatalogProductAttribute $attribute
* @param InjectableFixture $product
* @param string $sectionName
* @return void
*/
public function processAssert(CatalogProductIndex $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, InjectableFixture $product, $sectionName)
{
$catalogProductIndex->open()->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
$productForm = $catalogProductEdit->getProductForm();
if (!$productForm->checkAttributeLabel($attribute)) {
$productForm->openSection($sectionName);
}
$productForm->getAttributeElement($attribute)->setValue('');
$catalogProductEdit->getFormPageActions()->save();
$validationErrors = $productForm->getSection($sectionName)->getValidationErrors();
$actualMessage = isset($validationErrors[$attribute->getFrontendLabel()]) ? $validationErrors[$attribute->getFrontendLabel()] : '';
\PHPUnit_Framework_Assert::assertEquals(self::REQUIRE_MESSAGE, $actualMessage, 'JS error notice on product edit page is not equal to expected.');
}
示例14: processAssert
/**
* Assert form data equals duplicate product configurable data
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$duplicateProductSku = $product->getSku() . '-1';
$filter = ['sku' => $duplicateProductSku];
$productGrid->open();
$productGrid->getProductGrid()->searchAndOpen($filter);
$productData = $product->getData();
$productData['sku'] = $duplicateProductSku;
$productData['status'] = 'Product offline';
$fixtureData = $this->prepareFixtureData($productData, $this->sortFields);
$formData = $this->prepareFormData($productPage->getProductForm()->getData($product), $this->sortFields);
$error = $this->verifyData($fixtureData, $formData);
\PHPUnit_Framework_Assert::assertTrue(empty($error), $error);
}
示例15: processAssert
/**
* Assert all product attribute options on product creation form.
*
* @param InjectableFixture $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductAttribute $attribute
* @param CatalogProductEdit $productEdit
* @return void
*/
public function processAssert(InjectableFixture $product, CatalogProductIndex $productGrid, CatalogProductAttribute $attribute, CatalogProductEdit $productEdit)
{
$productGrid->open();
$productGrid->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
$attributeOptions = $attribute->getOptions();
$options[] = $attribute->getFrontendLabel();
foreach ($attributeOptions as $option) {
$options[] = $option['admin'];
}
$productAttributeOptions = $productEdit->getProductForm()->getAttributeElement($attribute)->getText();
$productOptions = explode("\n", $productAttributeOptions);
$diff = array_diff($options, $productOptions);
\PHPUnit_Framework_Assert::assertTrue(empty($diff), "Products attribute options are absent on product form: " . implode(', ', $diff));
}