/** * Test getShippingRate method */ public function testGetShippingRate() { $rate = $this->getMock('Magento\\Sales\\Model\\Quote\\Address\\Rate', ['__wakeup'], [], '', false); $this->shippingAddress->setShippingMethod(self::SHIPPING_METHOD); $this->shippingAddress->expects($this->once())->method('getShippingRateByCode')->with(self::SHIPPING_METHOD)->will($this->returnValue($rate)); $this->assertEquals($rate, $this->model->getShippingRate()); }
/** * @param bool $inclTax */ private function _prepareTestGetShippingPrice($inclTax) { $rate = $this->getMock('Magento\\Sales\\Model\\Quote\\Address\\Rate', ['__wakeup'], [], '', false); $rate->setPrice(self::SHIPPING_PRICE); $this->shippingAddress->setShippingMethod(self::SHIPPING_METHOD); $this->shippingAddress->expects($this->once())->method('getShippingRateByCode')->with(self::SHIPPING_METHOD)->will($this->returnValue($rate)); $this->taxHelper->expects($this->once())->method('getShippingPrice')->with(self::SHIPPING_PRICE, $inclTax ? $this->isTrue() : $this->isFalse(), $this->shippingAddress)->will($this->returnValue(self::SHIPPING_PRICE_WITH_TAX)); $this->store->expects($this->once())->method('formatPrice')->with(self::SHIPPING_PRICE_WITH_TAX)->will($this->returnValue(self::SHIPPING_PRICE_FORMATTED)); }