本文整理汇总了PHP中Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex类的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductIndex类的具体用法?PHP CatalogProductIndex怎么用?PHP CatalogProductIndex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CatalogProductIndex类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert that after deleting product success message.
*
* @param FixtureInterface|FixtureInterface[] $product
* @param CatalogProductIndex $productPage
* @return void
*/
public function processAssert($product, CatalogProductIndex $productPage)
{
$products = is_array($product) ? $product : [$product];
$deleteMessage = sprintf(self::SUCCESS_DELETE_MESSAGE, count($products));
$actualMessage = $productPage->getMessagesBlock()->getSuccessMessage();
\PHPUnit_Framework_Assert::assertEquals($deleteMessage, $actualMessage, 'Wrong success message is displayed.' . "\nExpected: " . $deleteMessage . "\nActual: " . $actualMessage);
}
示例2: processAssert
/**
* Assert that product is present in products grid and can be found by sku, type, status and attribute set.
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productIndex
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productIndex)
{
$this->product = $product;
$productIndex->open();
$productIndex->getProductGrid()->resetFilter();
\PHPUnit_Framework_Assert::assertTrue($productIndex->getProductGrid()->isRowVisible($this->prepareFilter()), 'Product \'' . $this->product->getName() . '\' is absent in Products grid.');
}
示例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: processAssert
/**
* Assert that after mass update successful message appears.
*
* @param CatalogProductIndex $productGrid
* @param array $products
* @return void
*/
public function processAssert(CatalogProductIndex $productGrid, $products = [])
{
$countProducts = count($products) ? count($products) : 1;
$expectedMessage = sprintf(self::SUCCESS_MESSAGE, $countProducts);
$actualMessage = $productGrid->getMessagesBlock()->getSuccessMessages();
\PHPUnit_Framework_Assert::assertEquals($expectedMessage, $actualMessage, 'Wrong success message is displayed.');
}
示例5: processAssert
/**
* Assert that duplicated product is found by sku and has correct product type, product template,
* product status disabled and out of stock
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid)
{
$config = $product->getDataConfig();
$filter = ['name' => $product->getName(), 'visibility' => $product->getVisibility(), 'status' => 'Disabled', 'sku' => $product->getSku() . '-1', 'type' => ucfirst($config['create_url_params']['type']) . ' Product', 'price_to' => number_format($product->getPrice(), 2)];
$productGrid->open()->getProductGrid()->search($filter);
$filter['price_to'] = '$' . $filter['price_to'];
\PHPUnit_Framework_Assert::assertTrue($productGrid->getProductGrid()->isRowVisible($filter, false), 'Product duplicate is absent in Products grid.');
}
示例6: processAssert
/**
* Assert that deleted attribute can't be added to attribute set on Product Page via Add Attribute control.
*
* @param CatalogProductAttribute $productAttribute
* @param CatalogProductIndex $productGrid
* @param CatalogProductNew $newProductPage
* @return void
*/
public function processAssert(CatalogProductAttribute $productAttribute, CatalogProductIndex $productGrid, CatalogProductNew $newProductPage)
{
$productGrid->open();
$productGrid->getGridPageActionBlock()->addProduct('simple');
$newProductPage->getFormPageActions()->addNewAttribute();
$filter = ['label' => $productAttribute->getFrontendLabel()];
\PHPUnit_Framework_Assert::assertFalse($newProductPage->getProductForm()->getAttributesSearchGrid()->isRowVisible($filter), 'Attribute \'' . $productAttribute->getFrontendLabel() . '\' is found in Attributes grid.');
}
开发者ID:Doability,项目名称:magento2dev,代码行数:16,代码来源:AssertProductAttributeAbsenceInSearchOnProductForm.php
示例7: processAssert
/**
* Assert that video is not displayed in admin panel.
*
* @param CatalogProductIndex $productGrid
* @param InjectableFixture $product
* @return void
*/
public function processAssert(CatalogProductIndex $productGrid, InjectableFixture $product)
{
$filter = ['sku' => $product->getSku()];
$productGrid->open();
$productGrid->getProductGrid()->search($filter);
$src = $productGrid->getProductGrid()->getBaseImageSource();
\PHPUnit_Framework_Assert::assertTrue(strpos($src, '/placeholder/') !== false, 'Product image is displayed in product grid when it should not');
}
示例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->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.');
}
示例9: processAssert
/**
* Assert that customer group not on product page.
*
* @param CatalogProductIndex $catalogProductIndex
* @param CatalogProductNew $catalogProductNew
* @param CustomerGroup $customerGroup
* @return void
*/
public function processAssert(CatalogProductIndex $catalogProductIndex, CatalogProductNew $catalogProductNew, CustomerGroup $customerGroup)
{
$catalogProductIndex->open();
$catalogProductIndex->getGridPageActionBlock()->addProduct();
$catalogProductNew->getProductForm()->openSection('advanced-pricing');
/** @var AdvancedPricing $advancedPricingTab */
$advancedPricingTab = $catalogProductNew->getProductForm()->getSection('advanced-pricing');
\PHPUnit_Framework_Assert::assertFalse($advancedPricingTab->getTierPriceForm()->isVisibleCustomerGroup($customerGroup), "Customer group {$customerGroup->getCustomerGroupCode()} is still in tier price form on product page.");
}
示例10: processAssert
/**
* Assert that product cannot be found by name and sku
*
* @param FixtureInterface|FixtureInterface[] $product
* @param CatalogProductIndex $productGrid
* @return void
*/
public function processAssert($product, CatalogProductIndex $productGrid)
{
$products = is_array($product) ? $product : [$product];
foreach ($products as $product) {
$filter = ['sku' => $product->getSku(), 'name' => $product->getName()];
$productGrid->open();
\PHPUnit_Framework_Assert::assertFalse($productGrid->getProductGrid()->isRowVisible($filter), "Product with sku \"{$filter['sku']}\" and name \"{$filter['name']}\" is attend in Products grid.");
}
}
示例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() . '-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);
}
示例12: 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.');
}
示例13: 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));
}
示例14: processAssert
/**
* 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->getProductForm();
$productBlockForm->fill($productConfigurable);
\PHPUnit_Framework_Assert::assertTrue($productBlockForm->checkAttributeInSearchAttributeForm($this->attribute), "Product attribute is absent on the product page.");
}
示例15: test
/**
* Test create grouped product
*
* @param GroupedProduct $product
* @param Category $category
* @return void
*/
public function test(GroupedProduct $product, Category $category)
{
//Steps
$this->catalogProductIndex->open();
$this->catalogProductIndex->getGridPageActionBlock()->addProduct('grouped');
$this->catalogProductNew->getProductForm()->fill($product, null, $category);
$this->catalogProductNew->getFormPageActions()->save();
}