/** * @dataProvider getMethodPriceProvider * @param int $cost * @param string $shippingMethod * @param bool $freeShippingEnabled * @param int $freeShippingSubtotal * @param int $requestSubtotal * @param int $expectedPrice * @covers \Magento\Shipping\Model\Carrier\AbstractCarrierOnline::getMethodPrice */ public function testGetMethodPrice($cost, $shippingMethod, $freeShippingEnabled, $freeShippingSubtotal, $requestSubtotal, $expectedPrice) { $path = 'carriers/' . $this->model->getCarrierCode() . '/'; $this->config->expects($this->any())->method('isSetFlag')->with($path . 'free_shipping_enable')->will($this->returnValue($freeShippingEnabled)); $this->config->expects($this->any())->method('getValue')->will($this->returnValueMap([[$path . 'free_method', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, null, self::FREE_METHOD_NAME], [$path . 'free_shipping_subtotal', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, null, $freeShippingSubtotal]])); $request = new \Magento\Quote\Model\Quote\Address\RateRequest(); $request->setBaseSubtotalInclTax($requestSubtotal); $this->model->setRawRequest($request); $price = $this->model->getMethodPrice($cost, $shippingMethod); $this->assertEquals($expectedPrice, $price); }
public function testCollectRatesFail() { $this->scope->expects($this->once())->method('isSetFlag')->willReturn(true); $request = new RateRequest(); $request->setPackageWeight(1); $this->assertSame($this->rate, $this->model->collectRates($request)); }
/** * Test ship accept url for live site * * @magentoConfigFixture current_store carriers/ups/is_account_live 1 */ public function testGetShipConfirmUrlLive() { $this->assertEquals('https://onlinetools.ups.com/ups.app/xml/ShipConfirm', $this->carrier->getShipConfirmUrl()); }