Esempio n. 1
0
 public function testCollectRatesErrorMessage()
 {
     $this->scope->expects($this->once())->method('isSetFlag')->willReturn(false);
     $this->error->expects($this->once())->method('setCarrier')->with('fedex');
     $this->error->expects($this->once())->method('setCarrierTitle');
     $this->error->expects($this->once())->method('setErrorMessage');
     $request = new RateRequest();
     $request->setPackageWeight(1);
     $this->assertSame($this->error, $this->_model->collectRates($request));
 }
Esempio n. 2
0
 /**
  * @dataProvider collectRatesDataProvider
  */
 public function testCollectRatesRateAmountOriginBased($amount, $rateType, $expected)
 {
     // @codingStandardsIgnoreStart
     $netAmount = new \Magento\Framework\Object([]);
     $netAmount->Amount = $amount;
     $totalNetCharge = new \Magento\Framework\Object([]);
     $totalNetCharge->TotalNetCharge = $netAmount;
     $totalNetCharge->RateType = $rateType;
     $ratedShipmentDetail = new \Magento\Framework\Object([]);
     $ratedShipmentDetail->ShipmentRateDetail = $totalNetCharge;
     $rate = new \Magento\Framework\Object([]);
     $rate->ServiceType = 'ServiceType';
     $rate->RatedShipmentDetails = [$ratedShipmentDetail];
     $response = new \Magento\Framework\Object([]);
     $response->HighestSeverity = 'SUCCESS';
     $response->RateReplyDetails = $rate;
     $this->_model->expects($this->any())->method('_getCachedQuotes')->will($this->returnValue(serialize($response)));
     $request = $this->getMock('Magento\\Quote\\Model\\Quote\\Address\\RateRequest', [], [], '', false);
     foreach ($this->_model->collectRates($request)->getAllRates() as $allRates) {
         $this->assertEquals($expected, $allRates->getData('cost'));
     }
     // @codingStandardsIgnoreEnd
 }