Tests for missing data
This commit is contained in:
parent
535db69152
commit
dfd9f50c8f
@ -111,4 +111,77 @@ class RateTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue(count($rates) > 0);
|
$this->assertTrue(count($rates) > 0);
|
||||||
$this->assertTrue($rates[0] instanceof Quote);
|
$this->assertTrue($rates[0] instanceof Quote);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @expectedException \LogicException
|
||||||
|
*/
|
||||||
|
public function testMissingKey()
|
||||||
|
{
|
||||||
|
$rateAdapter = new Rate([
|
||||||
|
'prod' => false,
|
||||||
|
'password' => 'XXX',
|
||||||
|
'accountNumber' => 'XXX',
|
||||||
|
'meterNumber' => 'XXX',
|
||||||
|
'dropOffType' => 'BUSINESS_SERVICE_CENTER',
|
||||||
|
'shipment' => $this->shipment,
|
||||||
|
'approvedCodes' => $this->approvedCodes,
|
||||||
|
'requestAdapter' => new StubFedex,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$rateAdapter->getRates();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @expectedException \LogicException
|
||||||
|
*/
|
||||||
|
public function testMissingPassword()
|
||||||
|
{
|
||||||
|
$rateAdapter = new Rate([
|
||||||
|
'prod' => false,
|
||||||
|
'key' => 'XXX',
|
||||||
|
'accountNumber' => 'XXX',
|
||||||
|
'meterNumber' => 'XXX',
|
||||||
|
'dropOffType' => 'BUSINESS_SERVICE_CENTER',
|
||||||
|
'shipment' => $this->shipment,
|
||||||
|
'approvedCodes' => $this->approvedCodes,
|
||||||
|
'requestAdapter' => new StubFedex,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$rateAdapter->getRates();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @expectedException \LogicException
|
||||||
|
*/
|
||||||
|
public function testMissingAccountNumber()
|
||||||
|
{
|
||||||
|
$rateAdapter = new Rate([
|
||||||
|
'prod' => false,
|
||||||
|
'key' => 'XXX',
|
||||||
|
'password' => 'XXX',
|
||||||
|
'meterNumber' => 'XXX',
|
||||||
|
'dropOffType' => 'BUSINESS_SERVICE_CENTER',
|
||||||
|
'shipment' => $this->shipment,
|
||||||
|
'approvedCodes' => $this->approvedCodes,
|
||||||
|
'requestAdapter' => new StubFedex,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$rateAdapter->getRates();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @expectedException \LogicException
|
||||||
|
*/
|
||||||
|
public function testMissingMeterNumber()
|
||||||
|
{
|
||||||
|
|
||||||
|
$rateAdapter = new Rate([
|
||||||
|
'prod' => false,
|
||||||
|
'key' => 'XXX',
|
||||||
|
'password' => 'XXX',
|
||||||
|
'accountNumber' => 'XXX',
|
||||||
|
'dropOffType' => 'BUSINESS_SERVICE_CENTER',
|
||||||
|
'shipment' => $this->shipment,
|
||||||
|
'approvedCodes' => $this->approvedCodes,
|
||||||
|
'requestAdapter' => new StubFedex,
|
||||||
|
]);
|
||||||
|
$rateAdapter->getRates();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,4 +101,55 @@ class RateTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue(count($rates) > 0);
|
$this->assertTrue(count($rates) > 0);
|
||||||
$this->assertTrue($rates[0] instanceof Quote);
|
$this->assertTrue($rates[0] instanceof Quote);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @expectedException \LogicException
|
||||||
|
*/
|
||||||
|
public function testMissingAccessKey()
|
||||||
|
{
|
||||||
|
$rateAdapter = new Rate([
|
||||||
|
'userId' => 'XXX',
|
||||||
|
'password' => 'XXX',
|
||||||
|
'shipperNumber' => 'XXX',
|
||||||
|
'prod' => false,
|
||||||
|
'shipment' => $this->shipment,
|
||||||
|
'approvedCodes' => $this->approvedCodes,
|
||||||
|
'requestAdapter' => new StubUPS,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$rateAdapter->getRates();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @expectedException \LogicException
|
||||||
|
*/
|
||||||
|
public function testMissingPassword()
|
||||||
|
{
|
||||||
|
$rateAdapter = new Rate([
|
||||||
|
'accessKey' => 'XXX',
|
||||||
|
'userId' => 'XXX',
|
||||||
|
'shipperNumber' => 'XXX',
|
||||||
|
'prod' => false,
|
||||||
|
'shipment' => $this->shipment,
|
||||||
|
'approvedCodes' => $this->approvedCodes,
|
||||||
|
'requestAdapter' => new StubUPS,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$rateAdapter->getRates();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,4 +83,35 @@ class RateTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue(count($rates) > 0);
|
$this->assertTrue(count($rates) > 0);
|
||||||
$this->assertTrue($rates[0] instanceof Quote);
|
$this->assertTrue($rates[0] instanceof Quote);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException \LogicException
|
||||||
|
*/
|
||||||
|
public function testMissingUserName()
|
||||||
|
{
|
||||||
|
$rateAdapter = new Rate([
|
||||||
|
'prod' => false,
|
||||||
|
'password' => 'XXXX',
|
||||||
|
'shipment' => $this->shipment,
|
||||||
|
'approvedCodes' => $this->approvedCodes,
|
||||||
|
'requestAdapter' => new StubUSPS,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$rateAdapter->getRates();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @expectedException \LogicException
|
||||||
|
*/
|
||||||
|
public function testMissingPassword()
|
||||||
|
{
|
||||||
|
$rateAdapter = new Rate([
|
||||||
|
'prod' => false,
|
||||||
|
'username' => 'XXX',
|
||||||
|
'shipment' => $this->shipment,
|
||||||
|
'approvedCodes' => $this->approvedCodes,
|
||||||
|
'requestAdapter' => new StubUSPS,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$rateAdapter->getRates();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user