示例#1
0
 public function testGetShippingPrice()
 {
     $shippingPrice = 5;
     $convertedPrice = "\$5";
     $shippingRateMock = $this->getMockBuilder('\\Magento\\Quote\\Model\\Quote\\Address\\Rate')->disableOriginalConstructor()->setMethods(['getPrice', '__wakeup'])->getMock();
     $shippingRateMock->expects($this->once())->method('getPrice')->will($this->returnValue($shippingPrice));
     $this->priceCurrency->expects($this->once())->method('convertAndFormat')->with($shippingPrice, true, true)->willReturn($convertedPrice);
     $this->priceObj->setShippingRate($shippingRateMock);
     $this->assertEquals($convertedPrice, $this->priceObj->getShippingPrice());
 }
示例#2
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Customer\Model\Session $customerSession
  * @param \Magento\Checkout\Model\Session $checkoutSession
  * @param PriceCurrencyInterface $priceCurrency
  * @param \Magento\Tax\Helper\Data $taxHelper
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, PriceCurrencyInterface $priceCurrency, \Magento\Tax\Helper\Data $taxHelper, array $data = [])
 {
     $this->taxHelper = $taxHelper;
     parent::__construct($context, $customerSession, $checkoutSession, $priceCurrency, $data);
 }
示例#3
0
文件: Price.php 项目: aiesh/magento2
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Catalog\Helper\Data $catalogData
  * @param \Magento\Customer\Model\Session $customerSession
  * @param \Magento\Checkout\Model\Session $checkoutSession
  * @param \Magento\Tax\Helper\Data $taxHelper
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Helper\Data $catalogData, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Tax\Helper\Data $taxHelper, array $data = array())
 {
     $this->taxHelper = $taxHelper;
     parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data);
 }