本文整理汇总了PHP中Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit类的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductEdit类的具体用法?PHP CatalogProductEdit怎么用?PHP CatalogProductEdit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CatalogProductEdit类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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.");
}
开发者ID:aiesh,项目名称:magento2,代码行数:16,代码来源:AssertProductAttributeAbsenceInVariationsSearch.php
示例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.');
}
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:16,代码来源:AssertGetVideoInfoDataIsCorrect.php
示例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.');
}
开发者ID:Atlis,项目名称:docker-magento2,代码行数:16,代码来源:AssertDownloadableProductForm.php
示例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.');
}
开发者ID:Doability,项目名称:magento2dev,代码行数:18,代码来源:AssertGetVideoInfoDataIsCorrect.php
示例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));
}
开发者ID:Atlis,项目名称:docker-magento2,代码行数:17,代码来源:AssertProductForm.php
示例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);
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:AssertProductDuplicateForm.php
示例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.');
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:AssertProductAttributeIsRequired.php
示例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);
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:AssertGroupedProductForm.php
示例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.');
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:22,代码来源:AssertProductAttributeIsUnique.php
示例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.");
}
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:24,代码来源:AssertAddedProductAttributeOnProductForm.php
示例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.");
}
开发者ID:niranjanssiet,项目名称:magento2,代码行数:25,代码来源:AssertProductTemplateGroupOnProductForm.php
示例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.');
}
开发者ID:Doability,项目名称:magento2dev,代码行数:23,代码来源:AssertProductAttributeIsUnique.php
示例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.');
}
开发者ID:Doability,项目名称:magento2dev,代码行数:23,代码来源:AssertProductAttributeIsRequired.php
示例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);
}
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:22,代码来源:AssertConfigurableProductDuplicateForm.php
示例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));
}
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:23,代码来源:AssertAttributeOptionsOnProductForm.php
示例16: 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 $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.");
}
开发者ID:Atlis,项目名称:docker-magento2,代码行数:28,代码来源:AssertProductTemplateOnProductForm.php
示例17: 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();
$productGrid->getProductGrid()->searchAndOpen($filter);
$productData = $product->getData();
if ($product->hasData('custom_options')) {
$customOptionsSource = $product->getDataFieldConfig('custom_options')['source'];
$productData['custom_options'] = $customOptionsSource->getCustomOptions();
}
$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);
}
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:23,代码来源:AssertProductForm.php
示例18: processAssert
/**
* Add this attribute to Default attribute Template. Create product and Assert that created attribute
* is displayed on product form (Products > Inventory > Catalog)
*
* @param FixtureFactory $fixtureFactory
* @param CatalogProductSetIndex $productSet
* @param CatalogProductSetEdit $productSetEdit
* @param CatalogAttributeSet $productTemplate
* @param CatalogProductIndex $productGrid
* @param CatalogProductAttribute $productAttributeOriginal
* @param CatalogProductEdit $productEdit
* @param CatalogProductAttribute|null $productAttribute
* @return void
*/
public function processAssert(FixtureFactory $fixtureFactory, CatalogProductSetIndex $productSet, CatalogProductSetEdit $productSetEdit, CatalogAttributeSet $productTemplate, CatalogProductIndex $productGrid, CatalogProductEdit $productEdit, CatalogProductAttribute $productAttribute, CatalogProductAttribute $productAttributeOriginal = null)
{
$filterAttribute = ['set_name' => $productTemplate->getAttributeSetName()];
$productSet->open();
$productSet->getGrid()->searchAndOpen($filterAttribute);
$attributeData = $productAttributeOriginal !== null ? array_merge($productAttribute->getData(), $productAttributeOriginal->getData()) : $productAttribute->getData();
$productSetEdit->getAttributeSetEditBlock()->moveAttribute($attributeData, 'Product Details');
$productSetEdit->getPageActions()->save();
$product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category', 'data' => ['attribute_set_id' => ['attribute_set' => $productTemplate]]]);
$product->persist();
$filterProduct = ['sku' => $product->getSku()];
$productGrid->open();
$productGrid->getProductGrid()->searchAndOpen($filterProduct);
$catalogProductAttribute = $productAttributeOriginal !== null ? array_merge($productAttributeOriginal->getData(), $productAttribute->getData()) : $productAttribute->getData();
\PHPUnit_Framework_Assert::assertTrue($productEdit->getProductForm()->checkAttributeLabel($catalogProductAttribute), "Product Attribute is absent on Product form.");
}
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:30,代码来源:AssertAddedProductAttributeOnProductForm.php
示例19: processAssert
/**
* Assert that displayed product data on edit page equals passed from fixture
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$productGrid->open()->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
$form = $productPage->getForm();
$formData = $form->getData($product);
foreach (array_keys($formData['configurable_attributes_data']['matrix']) as $key) {
unset($formData['configurable_attributes_data']['matrix'][$key]['price']);
}
$fixtureData = $this->prepareFixtureData($product->getData(), $product);
$attributes = $fixtureData['configurable_attributes_data']['attributes_data'];
$matrix = $fixtureData['configurable_attributes_data']['matrix'];
unset($fixtureData['configurable_attributes_data'], $fixtureData['id']);
$fixtureData['configurable_attributes_data']['attributes_data'] = $this->prepareAttributes($attributes);
$fixtureData['configurable_attributes_data']['matrix'] = $this->prepareMatrix($matrix);
$errors = $this->verifyData($fixtureData, $formData);
\PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
}
开发者ID:aiesh,项目名称:magento2,代码行数:25,代码来源:AssertConfigurableProductForm.php
示例20: 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 FixtureFactory $fixtureFactory
* @param CatalogProductIndex $catalogProductIndex
* @param CatalogProductEdit $catalogProductEdit
* @param CatalogProductAttribute $attribute
* @param CatalogAttributeSet $attributeSet
* @param CatalogProductAttribute $productAttributeOriginal
* @throws \Exception
* @return void
*/
public function processAssert(InjectableFixture $product, FixtureFactory $fixtureFactory, CatalogProductIndex $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttributeOriginal = null)
{
$this->fixtureFactory = $fixtureFactory;
$this->catalogProductIndex = $catalogProductIndex;
$this->catalogProductEdit = $catalogProductEdit;
if (!$product->hasData('sku')) {
if (!$productAttributeOriginal) {
$productAttributeOriginal = $attribute;
}
$product = $this->objectManager->create('Magento\\Catalog\\Test\\TestStep\\CreateProductWithAttributeSetStep', ['attribute' => $productAttributeOriginal, 'attributeSet' => $attributeSet])->run();
$product = $product['product'];
}
$filterProduct = ['sku' => $product->getSku()];
$catalogProductIndex->open();
$catalogProductIndex->getProductGrid()->searchAndOpen($filterProduct);
$catalogProductAttribute = $productAttributeOriginal !== null ? array_merge($productAttributeOriginal->getData(), $attribute->getData()) : $attribute->getData();
\PHPUnit_Framework_Assert::assertTrue($catalogProductEdit->getProductForm()->checkAttributeLabel($catalogProductAttribute), "Product Attribute is absent on Product form.");
}
开发者ID:koliaGI,项目名称:magento2,代码行数:32,代码来源:AssertAddedProductAttributeOnProductForm.php
注:本文中的Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论