public function testGetCatalogRegularPriceWhenPoolContainsPriceModelForGivenProductType() { $this->productMock->expects($this->any())->method('getTypeId')->will($this->returnValue('custom_product_type')); $this->priceFactoryMock->expects($this->once())->method('create')->with('CustomProduct/Model/CatalogPrice')->will($this->returnValue($this->catalogPriceInterfaceMock)); $this->catalogPriceInterfaceMock->expects($this->once())->method('getCatalogRegularPrice'); $this->productMock->expects($this->never())->method('getPrice'); $this->model->getCatalogRegularPrice($this->productMock); }
/** * Calculate price attribute value * * @param Product $product * @param \Magento\Store\Model\Store $store * @param int $priceDisplayType * @param bool $inclTax * @param bool $isSalePriceAllowed * @return float|null|string */ private function _getPrice($product, $store, $priceDisplayType, $inclTax, $isSalePriceAllowed) { $priceMapValue = $this->getProductAttributeValue($product); $price = null; if (!is_null($priceMapValue) && floatval($priceMapValue) > 0.0001) { $price = $priceMapValue; } else { if ($isSalePriceAllowed) { $price = $this->catalogPrice->getCatalogRegularPrice($product, $store); } else { $inclTax = $priceDisplayType != Config::DISPLAY_TYPE_EXCLUDING_TAX; $price = $this->catalogPrice->getCatalogPrice($product, $store, $inclTax); } } if ($product->getTypeId() != Product\Type::TYPE_BUNDLE) { $price = $this->_catalogData->getTaxPrice($product, $price, $inclTax, null, null, null, $product->getStoreId()); } return $price; }