Пример #1
0
 public function testDisplayOptions()
 {
     $rates = [];
     $usps = new USPS\Rate($this->getUSPSOptions());
     $rates['usps'] = $usps->getRates();
     $ups = new UPS\Rate($this->getUPSOptions());
     $rates['ups'] = $ups->getRates();
     $fedex = new Fedex\Rate($this->getFedexOptions());
     $rates['fedex'] = $fedex->getRates();
     $ship = Ship::factory($this->shipping_options);
     $rates = $ship->getDisplayRates($rates);
     $post = new Quote('usps', '4', 'Parcel Post', 1001);
     $fedexTwoDay = new Quote('fedex', 'FEDEX_2_DAY', 'Fedex 2 Day', 4072);
     $fedexTwoDay->setDeliveryEstimate(new DateTime('2014-09-29T20:00:00'));
     $overnight = new Quote('fedex', 'STANDARD_OVERNIGHT', 'Standard Overnight', 7834);
     $overnight->setDeliveryEstimate(new DateTime('2014-09-26T20:00:00'));
     $expected = ['Standard Shipping' => [$post], 'Two-Day Shipping' => [$fedexTwoDay], 'One-Day Shipping' => [$overnight]];
     $this->assertEquals($expected, $rates);
 }
Пример #2
0
 /**
  * @expectedException \LogicException
  */
 public function testMissingShipperNumber()
 {
     $rateAdapter = new Rate(['accessKey' => 'XXX', 'userId' => 'XXX', 'password' => 'XXX', 'prod' => false, 'shipment' => $this->shipment, 'approvedCodes' => $this->approvedCodes, 'requestAdapter' => new StubUPS()]);
     $rateAdapter->getRates();
 }