本文整理汇总了PHP中Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex::getProductGrid方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductIndex::getProductGrid方法的具体用法?PHP CatalogProductIndex::getProductGrid怎么用?PHP CatalogProductIndex::getProductGrid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex
的用法示例。
在下文中一共展示了CatalogProductIndex::getProductGrid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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.');
}
示例2: 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');
}
示例3: 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();
}
示例4: 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];
}
示例5: 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];
}
示例6: test
/**
* Run delete product test.
*
* @param string $products
* @param FixtureFactory $fixtureFactory
* @param Category $category
* @return array
*/
public function test($products, FixtureFactory $fixtureFactory, Category $category)
{
//Steps
$products = explode(',', $products);
$deleteProducts = [];
foreach ($products as &$product) {
list($fixture, $dataset) = explode('::', $product);
$product = $fixtureFactory->createByCode($fixture, ['dataset' => $dataset, 'data' => ['category_ids' => ['category' => $category]]]);
$product->persist();
$deleteProducts[] = ['sku' => $product->getSku()];
}
$this->catalogProductIndex->open();
$this->catalogProductIndex->getProductGrid()->massaction($deleteProducts, 'Delete', true);
return ['product' => $products];
}
示例7: test
/**
* Run mass update product simple entity test.
*
* @param CatalogProductSimple $initialProduct
* @param CatalogProductSimple $product
* @param string $configData
* @return array
*/
public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product, $configData)
{
$this->configData = $configData;
// Preconditions
$initialProduct->persist();
$this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $configData])->run();
// Steps
$this->productGrid->open();
$this->productGrid->getProductGrid()->updateAttributes([['sku' => $initialProduct->getSku()]]);
$this->attributeMassActionPage->getAttributesBlockForm()->fill($product);
$this->attributeMassActionPage->getFormPageActions()->save();
$data = array_merge($initialProduct->getData(), $product->getData());
$product = $this->objectManager->create('Magento\\Catalog\\Test\\Fixture\\CatalogProductSimple', ['data' => $data]);
return ['category' => $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0], 'product' => $product];
}
示例8: test
/**
* Run update product simple entity test.
*
* @param CatalogProductSimple $initialProduct
* @param CatalogProductSimple $product
* @param string $configData
* @return array
*/
public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product, $configData = '')
{
$this->configData = $configData;
// 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;
$this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $configData])->run();
// 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];
}
示例9: 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.');
}
示例10: 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();
}
示例11: 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();
}
示例12: 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.");
}
}
示例13: 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.');
}
示例14: 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);
$fixtureData = $this->prepareFixtureData($product->getData(), $product, $this->sortFields);
$formData = $this->prepareFormData($productPage->getForm()->getData($product), $this->sortFields);
$error = $this->verifyData($fixtureData, $formData);
\PHPUnit_Framework_Assert::assertTrue(empty($error), $error);
}
示例15: 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.");
}