Drop Carbon requirement
This commit is contained in:
parent
b911e8923d
commit
66d7f46d61
@ -9,9 +9,6 @@
|
|||||||
"email": "pdt256@gmail.com"
|
"email": "pdt256@gmail.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
|
||||||
"nesbot/carbon": "~1.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "4.0.*"
|
"phpunit/phpunit": "4.0.*"
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace pdt256\Shipping\Fedex;
|
namespace pdt256\Shipping\Fedex;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use DateTime;
|
||||||
use pdt256\Shipping;
|
use pdt256\Shipping;
|
||||||
use pdt256\Shipping\Arr;
|
use pdt256\Shipping\Arr;
|
||||||
use pdt256\Shipping\Quote;
|
use pdt256\Shipping\Quote;
|
||||||
@ -230,7 +230,7 @@ class Rate extends RateAdapter
|
|||||||
->setCost((int) $cost * 100)
|
->setCost((int) $cost * 100)
|
||||||
->setTransitTime($transit_time);
|
->setTransitTime($transit_time);
|
||||||
if ($delivery_ts) {
|
if ($delivery_ts) {
|
||||||
$quote->setDeliveryEstimate(new Carbon($delivery_ts));
|
$quote->setDeliveryEstimate(new DateTime($delivery_ts));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->rates[] = $quote;
|
$this->rates[] = $quote;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php namespace pdt256\Shipping;
|
<?php namespace pdt256\Shipping;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use DateTime;
|
||||||
|
|
||||||
class Quote
|
class Quote
|
||||||
{
|
{
|
||||||
@ -112,10 +112,10 @@ class Quote
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $estimate
|
* @param DateTime $estimate
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setDeliveryEstimate(Carbon $estimate)
|
public function setDeliveryEstimate(DateTime $estimate)
|
||||||
{
|
{
|
||||||
$this->delivery_ts = $estimate;
|
$this->delivery_ts = $estimate;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
use Carbon\Carbon;
|
|
||||||
use pdt256\Shipping\Package;
|
use pdt256\Shipping\Package;
|
||||||
use pdt256\Shipping\Quote;
|
use pdt256\Shipping\Quote;
|
||||||
use pdt256\Shipping\Ship;
|
use pdt256\Shipping\Ship;
|
||||||
@ -201,7 +200,7 @@ class ShipTest extends PHPUnit_Framework_TestCase
|
|||||||
->setCode('FEDEX_EXPRESS_SAVER')
|
->setCode('FEDEX_EXPRESS_SAVER')
|
||||||
->setName('Fedex Express Saver')
|
->setName('Fedex Express Saver')
|
||||||
->setCost(2900)
|
->setCost(2900)
|
||||||
->setDeliveryEstimate(new Carbon('2014-09-30T20:00:00'))
|
->setDeliveryEstimate(new DateTime('2014-09-30T20:00:00'))
|
||||||
->setTransitTime(null);
|
->setTransitTime(null);
|
||||||
|
|
||||||
$secondday = new Quote;
|
$secondday = new Quote;
|
||||||
@ -210,7 +209,7 @@ class ShipTest extends PHPUnit_Framework_TestCase
|
|||||||
->setCode('FEDEX_2_DAY')
|
->setCode('FEDEX_2_DAY')
|
||||||
->setName('Fedex 2 Day')
|
->setName('Fedex 2 Day')
|
||||||
->setCost(4000)
|
->setCost(4000)
|
||||||
->setDeliveryEstimate(new Carbon('2014-09-29T20:00:00'))
|
->setDeliveryEstimate(new DateTime('2014-09-29T20:00:00'))
|
||||||
->setTransitTime(null);
|
->setTransitTime(null);
|
||||||
|
|
||||||
$overnight = new Quote;
|
$overnight = new Quote;
|
||||||
@ -219,7 +218,7 @@ class ShipTest extends PHPUnit_Framework_TestCase
|
|||||||
->setCode('STANDARD_OVERNIGHT')
|
->setCode('STANDARD_OVERNIGHT')
|
||||||
->setName('Standard Overnight')
|
->setName('Standard Overnight')
|
||||||
->setCost(7800)
|
->setCost(7800)
|
||||||
->setDeliveryEstimate(new Carbon('2014-09-26T20:00:00'))
|
->setDeliveryEstimate(new DateTime('2014-09-26T20:00:00'))
|
||||||
->setTransitTime(null);
|
->setTransitTime(null);
|
||||||
|
|
||||||
$expected_result = [$ground, $express, $secondday, $overnight];
|
$expected_result = [$ground, $express, $secondday, $overnight];
|
||||||
@ -253,14 +252,14 @@ class ShipTest extends PHPUnit_Framework_TestCase
|
|||||||
$fedex_two_day->setCode('FEDEX_2_DAY')
|
$fedex_two_day->setCode('FEDEX_2_DAY')
|
||||||
->setName('Fedex 2 Day')
|
->setName('Fedex 2 Day')
|
||||||
->setCost(4000)
|
->setCost(4000)
|
||||||
->setDeliveryEstimate(new Carbon('2014-09-29T20:00:00'))
|
->setDeliveryEstimate(new DateTime('2014-09-29T20:00:00'))
|
||||||
->setCarrier('fedex');
|
->setCarrier('fedex');
|
||||||
|
|
||||||
$overnight = new Quote;
|
$overnight = new Quote;
|
||||||
$overnight->setCode('STANDARD_OVERNIGHT')
|
$overnight->setCode('STANDARD_OVERNIGHT')
|
||||||
->setName('Standard Overnight')
|
->setName('Standard Overnight')
|
||||||
->setCost(7800)
|
->setCost(7800)
|
||||||
->setDeliveryEstimate(new Carbon('2014-09-26T20:00:00'))
|
->setDeliveryEstimate(new DateTime('2014-09-26T20:00:00'))
|
||||||
->setCarrier('fedex');
|
->setCarrier('fedex');
|
||||||
|
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
|
Loading…
x
Reference in New Issue
Block a user