本文整理汇总了PHP中Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit::getForm方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductEdit::getForm方法的具体用法?PHP CatalogProductEdit::getForm怎么用?PHP CatalogProductEdit::getForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit
的用法示例。
在下文中一共展示了CatalogProductEdit::getForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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->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.");
}
示例2: 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.");
}
示例3: 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.");
}
示例4: testUpdateDownloadableProduct
/**
* Test update downloadable product
*
* @param CatalogProductDownloadable $product
* @param CatalogCategory $category
* @return void
*/
public function testUpdateDownloadableProduct(CatalogProductDownloadable $product, CatalogCategory $category)
{
$filter = ['sku' => $this->product->getSku()];
$this->catalogProductIndex->open()->getProductGrid()->searchAndOpen($filter);
$productBlockForm = $this->catalogProductEdit->getForm();
$productBlockForm->fillProduct($product, $category);
$this->catalogProductEdit->getFormAction()->save();
}
示例5: 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);
$productBlockForm = $this->editProductPage->getForm();
$productBlockForm->fillProduct($product);
$this->editProductPage->getFormAction()->save();
}
示例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->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.');
}
示例7: 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->getForm()->fill($product);
$this->editProductPage->getFormAction()->save();
}
示例8: 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->getForm()->fill($product);
$this->catalogProductEdit->getFormAction()->save();
}
示例9: 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->getForm()->getData($product);
$fixtureData = $this->prepareFixtureData($product->getData(), $product);
$errors = $this->verifyData($fixtureData, $formData);
\PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
}
示例10: 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));
}
示例11: 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->getForm()->getData($product);
$fieldsFixture = $this->prepareFixtureData($product->getData());
$fieldsFixture['associated'] = $this->prepareGroupedOptions($fieldsFixture['associated']);
$errors = $this->verifyData($fieldsFixture, $fieldsForm);
\PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
}
示例12: test
/**
* Test update grouped product
*
* @param CatalogProductGrouped $product
* @param CatalogProductGrouped $originalProduct
* @return void
*/
public function test(CatalogProductGrouped $product, CatalogProductGrouped $originalProduct)
{
// Precondition
$originalProduct->persist();
// Steps
$this->catalogProductIndex->open();
$this->catalogProductIndex->getProductGrid()->searchAndOpen(['sku' => $originalProduct->getSku()]);
$this->catalogProductEdit->getForm()->fill($product);
$this->catalogProductEdit->getFormAction()->save();
}
示例13: 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->getForm()->checkAttributeLabel($catalogProductAttribute), "Product Attribute is absent on Product form.");
}
示例14: test
/**
* Update product review on product page
*
* @param ReviewInjectable $review
* @param int $rating
* @return array
*/
public function test(ReviewInjectable $review, $rating)
{
// Steps
$review = $this->createReview($review, $rating);
$this->catalogProductIndex->open();
/** @var CatalogProductSimple $product */
$product = $this->reviewInitial->getDataFieldConfig('entity_id')['source']->getEntity();
$this->catalogProductIndex->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
$this->catalogProductEdit->getForm()->openTab('product_reviews');
$filter = ['title' => $this->reviewInitial->getTitle(), 'sku' => $product->getSku()];
$this->catalogProductEdit->getForm()->getTabElement('product_reviews')->getReviewsGrid()->searchAndOpen($filter);
$this->reviewEdit->getReviewForm()->fill($review);
$this->reviewEdit->getPageActions()->save();
$productRating = $this->reviewInitial->getDataFieldConfig('ratings')['source']->getRatings()[0];
return ['product' => $product, 'productRating' => $productRating];
}
示例15: 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);
}