/** * Assert prices on the product view Page * * @param BundleProduct $product * @param CatalogProductView $catalogProductView * @return void */ protected function assertPrice(BundleProduct $product, CatalogProductView $catalogProductView) { $priceData = $product->getDataFieldConfig('price')['source']->getPreset(); $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock(); $priceLow = $product->getPriceView() == 'Price Range' ? $priceBlock->getPriceFrom() : $priceBlock->getRegularPrice(); \PHPUnit_Framework_Assert::assertEquals($priceData['price_from'], $priceLow, 'Bundle price From on product view page is not correct.'); if ($product->getPriceView() == 'Price Range') { \PHPUnit_Framework_Assert::assertEquals($priceData['price_to'], $priceBlock->getPriceTo(), 'Bundle price To on product view page is not correct.'); } }
/** * Verify product price on category view page * * @param BundleProduct $bundle * @param CatalogCategoryView $catalogCategoryView * @return void */ protected function assertPrice(BundleProduct $bundle, CatalogCategoryView $catalogCategoryView) { $priceData = $bundle->getDataFieldConfig('price')['source']->getPreset(); //Price from/to verification $priceBlock = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($bundle->getName()); $priceLow = $bundle->getPriceView() == 'Price Range' ? $priceBlock->getPriceFrom() : $priceBlock->getRegularPrice(); \PHPUnit_Framework_Assert::assertEquals($priceData['price_from'], $priceLow, 'Bundle price From on category page is not correct.'); if ($bundle->getPriceView() == 'Price Range') { \PHPUnit_Framework_Assert::assertEquals($priceData['price_to'], $priceBlock->getPriceTo(), 'Bundle price To on category page is not correct.'); } }