本文整理汇总了PHP中Magento\Catalog\Test\Fixture\CatalogProductSimple::getGroupPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductSimple::getGroupPrice方法的具体用法?PHP CatalogProductSimple::getGroupPrice怎么用?PHP CatalogProductSimple::getGroupPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Test\Fixture\CatalogProductSimple
的用法示例。
在下文中一共展示了CatalogProductSimple::getGroupPrice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertOnProductView
/**
* Assert data on the product view page
*
* @param CatalogProductSimple $product
* @param CatalogProductView $catalogProductView
* @return void
*/
protected function assertOnProductView(CatalogProductSimple $product, CatalogProductView $catalogProductView)
{
$viewBlock = $catalogProductView->getViewBlock();
$price = $viewBlock->getProductPriceBlock()->getPrice();
$name = $viewBlock->getProductName();
$sku = $viewBlock->getProductSku();
\PHPUnit_Framework_Assert::assertEquals($product->getName(), $name, 'Product name on product view page is not correct.');
\PHPUnit_Framework_Assert::assertEquals($product->getSku(), $sku, 'Product sku on product view page is not correct.');
if (isset($price['price_regular_price'])) {
\PHPUnit_Framework_Assert::assertEquals(number_format($product->getPrice(), 2), $price['price_regular_price'], 'Product regular price on product view page is not correct.');
}
$priceComparing = false;
if ($specialPrice = $product->getSpecialPrice()) {
$priceComparing = $specialPrice;
}
if ($groupPrice = $product->getGroupPrice()) {
$groupPrice = reset($groupPrice);
$priceComparing = $groupPrice['price'];
}
if ($priceComparing && isset($price['price_special_price'])) {
\PHPUnit_Framework_Assert::assertEquals(number_format($priceComparing, 2), $price['price_special_price'], 'Product special price on product view page is not correct.');
}
}