|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Octante\UpsAPIBundle\Tests\Unit\Library; |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of the UpsAPIBundle package. |
|
7
|
|
|
* |
|
8
|
|
|
* (c) Issel Guberna <[email protected]> |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
11
|
|
|
* file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
use Octante\UpsAPIBundle\Library\TradeabilityWrapper; |
|
15
|
|
|
|
|
16
|
|
|
class TradeabilityTest extends \PHPUnit_Framework_TestCase |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @var |
|
20
|
|
|
*/ |
|
21
|
|
|
private $tradeabilityMock; |
|
22
|
|
|
|
|
23
|
|
|
public function setUp() |
|
24
|
|
|
{ |
|
25
|
|
|
$this->tradeabilityMock = $this->getMock('Ups\Tradeability'); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* when: getLandedCostsIsCalled |
|
30
|
|
|
* should: callUpsTradeabilityGetLandedCostsMethod. |
|
31
|
|
|
*/ |
|
32
|
|
|
public function testTradeabilityGetLandedCostMethodIsCalled() |
|
33
|
|
|
{ |
|
34
|
|
|
$landedCostRequestMock = $this->getMock('Ups\Entity\Tradeability\LandedCostRequest'); |
|
35
|
|
|
$this->tradeabilityMock |
|
36
|
|
|
->expects($this->once()) |
|
37
|
|
|
->method('getLandedCosts') |
|
38
|
|
|
->with($landedCostRequestMock); |
|
39
|
|
|
|
|
40
|
|
|
$sut = new TradeabilityWrapper($this->tradeabilityMock); |
|
41
|
|
|
|
|
42
|
|
|
$sut->getLandedCosts($landedCostRequestMock); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* when: getRequestIsCalled |
|
47
|
|
|
* should: callUpsTradeabilityGetRequestMethod. |
|
48
|
|
|
*/ |
|
49
|
|
|
public function testTradeabilityGetRequestMethodIsCalled() |
|
50
|
|
|
{ |
|
51
|
|
|
$requestMock = $this->getMock('Ups\Request'); |
|
52
|
|
|
$this |
|
53
|
|
|
->tradeabilityMock |
|
54
|
|
|
->method('getRequest') |
|
55
|
|
|
->willReturn($requestMock); |
|
56
|
|
|
|
|
57
|
|
|
$sut = new TradeabilityWrapper($this->tradeabilityMock); |
|
58
|
|
|
$sut->setRequest($requestMock); |
|
59
|
|
|
$request = $sut->getRequest(); |
|
60
|
|
|
$this->assertInstanceOf('Ups\Request', $request); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|