本文整理匯總了PHP中Magento\Catalog\Test\Page\Product\CatalogProductView::getGroupedViewBlock方法的典型用法代碼示例。如果您正苦於以下問題:PHP CatalogProductView::getGroupedViewBlock方法的具體用法?PHP CatalogProductView::getGroupedViewBlock怎麽用?PHP CatalogProductView::getGroupedViewBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Catalog\Test\Page\Product\CatalogProductView
的用法示例。
在下文中一共展示了CatalogProductView::getGroupedViewBlock方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: processAssert
/**
* Assert that default qty for sub products in grouped product displays according to dataset on product page.
*
* @param CatalogProductView $groupedProductView
* @param CatalogProductGrouped $product
* @param Browser $browser
* @return void
*/
public function processAssert(CatalogProductView $groupedProductView, CatalogProductGrouped $product, Browser $browser)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$groupedBlock = $groupedProductView->getGroupedViewBlock()->getGroupedProductBlock();
$groupedProduct = $product->getData();
foreach ($groupedProduct['associated']['assigned_products'] as $item) {
\PHPUnit_Framework_Assert::assertEquals($groupedBlock->getQty($item['id']), $item['qty'], 'Default qty for sub product "' . $item['name'] . '" in grouped product according to dataset.');
}
}
示例2: processAssertPrice
/**
* Verify product price on grouped product view page
*
* @param CatalogProductGrouped $product
* @param CatalogProductView $catalogProductView
* @param AssertPriceOnProductPageInterface $object
* @param Browser $browser
* @param string $typePrice [optional]
* @return bool|string
*/
protected function processAssertPrice(CatalogProductGrouped $product, CatalogProductView $catalogProductView, AssertPriceOnProductPageInterface $object, Browser $browser, $typePrice = '')
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$groupedData = $product->getAssociated();
/** @var InjectableFixture $subProduct */
foreach ($groupedData['products'] as $key => $subProduct) {
//Process assertions
$catalogProductView->getGroupedViewBlock()->{'item' . $typePrice . 'PriceProductBlock'}(++$key);
$object->setErrorMessage(sprintf($this->errorMessage, $subProduct->getData('name')));
$object->assertPrice($subProduct, $catalogProductView, 'Grouped');
}
}