本文整理汇总了PHP中Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit::getFormPageActions方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductEdit::getFormPageActions方法的具体用法?PHP CatalogProductEdit::getFormPageActions怎么用?PHP CatalogProductEdit::getFormPageActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit
的用法示例。
在下文中一共展示了CatalogProductEdit::getFormPageActions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test
/**
* Test update grouped product.
*
* @param GroupedProduct $product
* @param GroupedProduct $originalProduct
* @return void
*/
public function test(GroupedProduct $product, GroupedProduct $originalProduct)
{
// Precondition
$originalProduct->persist();
// Steps
$this->catalogProductIndex->open();
$this->catalogProductIndex->getProductGrid()->searchAndOpen(['sku' => $originalProduct->getSku()]);
$this->catalogProductEdit->getProductForm()->fill($product);
$this->catalogProductEdit->getFormPageActions()->save();
}
示例2: test
/**
* Test update bundle product
*
* @param BundleProduct $product
* @param BundleProduct $originalProduct
* @return array
*/
public function test(BundleProduct $product, BundleProduct $originalProduct)
{
// Preconditions
$originalProduct->persist();
$originalCategory = $originalProduct->hasData('category_ids') ? $originalProduct->getDataFieldConfig('category_ids')['source']->getCategories() : null;
$category = $product->hasData('category_ids') ? $product->getDataFieldConfig('category_ids')['source']->getCategories() : $originalCategory;
// Steps
$filter = ['sku' => $originalProduct->getSku()];
$this->catalogProductIndex->open();
$this->catalogProductIndex->getProductGrid()->searchAndOpen($filter);
$this->catalogProductEdit->getProductForm()->fill($product);
$this->catalogProductEdit->getFormPageActions()->save();
return ['category' => $category];
}
示例3: test
/**
* Run update product simple entity test
*
* @param CatalogProductSimple $initialProduct
* @param CatalogProductSimple $product
* @return array
*/
public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product)
{
// Preconditions
$initialProduct->persist();
$initialCategory = $initialProduct->hasData('category_ids') ? $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0] : null;
$category = $product->hasData('category_ids') && $product->getCategoryIds()[0] ? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0] : $initialCategory;
// Steps
$filter = ['sku' => $initialProduct->getSku()];
$this->productGrid->open();
$this->productGrid->getProductGrid()->searchAndOpen($filter);
$this->editProductPage->getProductForm()->fill($product);
$this->editProductPage->getFormPageActions()->save();
return ['category' => $category];
}
示例4: testUpdate
/**
* Run update product simple entity test
*
* @param CatalogProductSimple $product
* @return void
*/
public function testUpdate(CatalogProductSimple $product)
{
$filter = ['sku' => $this->product->getSku()];
$this->productGrid->open()->getProductGrid()->searchAndOpen($filter);
$this->editProductPage->getProductForm()->fill($product);
$this->editProductPage->getFormPageActions()->save();
}
示例5: testUpdateDownloadableProduct
/**
* Test update downloadable product
*
* @param DownloadableProductInjectable $product
* @param CatalogCategory $category
* @return void
*/
public function testUpdateDownloadableProduct(DownloadableProductInjectable $product, CatalogCategory $category)
{
$filter = ['sku' => $this->product->getSku()];
$this->catalogProductIndex->open()->getProductGrid()->searchAndOpen($filter);
$productBlockForm = $this->catalogProductEdit->getProductForm();
$productBlockForm->fill($product, null, $category);
$this->catalogProductEdit->getFormPageActions()->save();
}
示例6: test
/**
* Run update product virtual entity test
*
* @param CatalogProductVirtual $product
* @return void
*/
public function test(CatalogProductVirtual $product)
{
// Steps
$this->productGrid->open();
$this->productGrid->getProductGrid()->searchAndOpen(['sku' => $this->product->getSku()]);
$this->editProductPage->getProductForm()->fill($product);
$this->editProductPage->getFormPageActions()->save();
}
示例7: test
/**
* Test update bundle product
*
* @param CatalogProductBundle $product
* @param CatalogProductBundle $originalProduct
* @return void
*/
public function test(CatalogProductBundle $product, CatalogProductBundle $originalProduct)
{
$originalProduct->persist();
$this->catalogProductIndex->open();
$filter = ['sku' => $originalProduct->getSku()];
$this->catalogProductIndex->getProductGrid()->searchAndOpen($filter);
$this->catalogProductEdit->getProductForm()->fill($product);
$this->catalogProductEdit->getFormPageActions()->save();
}
示例8: 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.');
}
示例9: test
/**
* Run test duplicate product entity.
*
* @param string $productType
* @return array
*/
public function test($productType)
{
// Precondition
$product = $this->createProduct($productType);
// Steps
$filter = ['sku' => $product->getSku()];
$this->productGrid->open();
$this->productGrid->getProductGrid()->searchAndOpen($filter);
$this->editProductPage->getFormPageActions()->saveAndDuplicate();
return ['product' => $product];
}
示例10: 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.');
}
示例11: 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.');
}
示例12: 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.');
}
示例13: run
/**
* Create a new product with the given attribute set
*
* @return array
*/
public function run()
{
// Create product with attribute set mentioned above:
$customAttribute = $this->attribute;
if ($this->attributeValue !== null) {
$customAttribute = ['value' => $this->attributeValue, 'attribute' => $customAttribute];
}
$product = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'product_with_category_with_anchor', 'data' => ['attribute_set_id' => ['attribute_set' => $this->attributeSet], 'custom_attribute' => $customAttribute]]);
$this->catalogProductIndex->open()->getGridPageActionBlock()->addProduct('simple');
$productForm = $this->catalogProductEdit->getProductForm();
$productForm->fill($product);
$this->catalogProductEdit->getFormPageActions()->save();
return ['product' => $product];
}
示例14: run
/**
* Move attribute To attribute set.
*
* @return array
*/
public function run()
{
$filterAttribute = ['set_name' => $this->attributeSet->getAttributeSetName()];
$this->catalogProductSetIndex->open()->getGrid()->searchAndOpen($filterAttribute);
$this->catalogProductSetEdit->getAttributeSetEditBlock()->moveAttribute($this->attribute->getData());
$this->catalogProductSetEdit->getPageActions()->save();
// Create product with attribute set mentioned above:
$product = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'product_with_category_with_anchor', 'data' => ['attribute_set_id' => ['attribute_set' => $this->attributeSet], 'custom_attribute' => $this->attribute]]);
$this->catalogProductIndex->open()->getGridPageActionBlock()->addProduct('simple');
$productForm = $this->catalogProductEdit->getProductForm();
$productForm->fill($product);
$this->catalogProductEdit->getFormPageActions()->save();
return ['product' => $product];
}
示例15: test
/**
* Run product type switching on updating test.
*
* @param string $productOrigin
* @param string $product
* @param string $actionName
* @return array
*/
public function test($productOrigin, $product, $actionName)
{
// Preconditions
list($fixtureClass, $dataset) = explode('::', $productOrigin);
$productOrigin = $this->fixtureFactory->createByCode(trim($fixtureClass), ['dataset' => trim($dataset)]);
$productOrigin->persist();
list($fixtureClass, $dataset) = explode('::', $product);
$product = $this->fixtureFactory->createByCode(trim($fixtureClass), ['dataset' => trim($dataset)]);
// Steps
$this->catalogProductIndex->open();
$this->catalogProductIndex->getProductGrid()->searchAndOpen(['sku' => $productOrigin->getSku()]);
$this->performAction($actionName);
$this->catalogProductEdit->getProductForm()->fill($product);
$this->catalogProductEdit->getFormPageActions()->save($product);
return ['product' => $product];
}