/** * Format total value based on order currency * * @param \Magento\Framework\Object $total * @return string */ public function formatValue($total) { if (!$total->getIsFormated()) { return $this->_adminHelper->displayPrices($this->getOrder(), $total->getBaseValue(), $total->getValue()); } return $total->getValue(); }
/** * @param string $expected * @param bool $dataObjectIsOrder * @param bool $isCurrencyDifferent * @param bool $magentoDataObjectHasOrder * @param bool $strong * @param string $separator * @dataProvider displayPricesDataProvider */ public function testDisplayPrices($expected, $dataObjectIsOrder, $isCurrencyDifferent = true, $magentoDataObjectHasOrder = true, $strong = false, $separator = '<br/>') { $this->orderMock->expects($this->any())->method('isCurrencyDifferent')->will($this->returnValue($isCurrencyDifferent)); $storeMock = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->getMock(); $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($storeMock)); $this->priceCurrency->expects($this->any())->method('format')->will($this->returnValue('storeFormattedPrice')); $dataObject = $this->orderMock; if (!$dataObjectIsOrder) { $returnRes = false; if ($magentoDataObjectHasOrder) { $returnRes = $this->orderMock; } $this->magentoObjectMock->expects($this->once())->method('getOrder')->will($this->returnValue($returnRes)); $dataObject = $this->magentoObjectMock; } $basePrice = 10.0; $price = 15.0; $this->assertEquals($expected, $this->adminHelper->displayPrices($dataObject, $basePrice, $price, $strong, $separator)); }
/** * Display prices * * @param float $basePrice * @param float $price * @param bool $strong * @param string $separator * @return string */ public function displayPrices($basePrice, $price, $strong = false, $separator = '<br/>') { return $this->_adminHelper->displayPrices($this->getPriceDataObject(), $basePrice, $price, $strong, $separator); }
/** * Display tax amount * * @param string $amount * @param string $baseAmount * @return string */ public function displayAmount($amount, $baseAmount) { return $this->_salesAdminHelper->displayPrices($this->getSource(), $baseAmount, $amount, false, '<br />'); }