1 | <?php |
||
8 | class OrdersTest extends TestCase |
||
9 | { |
||
10 | /** |
||
11 | * Send http request. |
||
12 | * |
||
13 | * @param \Moip\Resource\Orders $order |
||
14 | * @param string $body |
||
15 | * |
||
16 | * @return \Moip\Resource\Orders |
||
17 | */ |
||
18 | private function executeOrder(Orders $order = null, $body = null) |
||
30 | |||
31 | /** |
||
32 | * @const string |
||
33 | */ |
||
34 | public function testAssertConstPath() |
||
38 | |||
39 | /** |
||
40 | * Tests if the primary receiver constant has the correct value. |
||
41 | * |
||
42 | * @const string |
||
43 | */ |
||
44 | public function testAssertConstReceiverTypePrimary() |
||
48 | |||
49 | /** |
||
50 | * Tests if the secondary receiver constant has the correct value. |
||
51 | * |
||
52 | * @const string |
||
53 | */ |
||
54 | public function testAssertConstReceiverTypeSecpndary() |
||
58 | |||
59 | /** |
||
60 | * Tests the currency in the order creation response. |
||
61 | * |
||
62 | * @const string |
||
63 | */ |
||
64 | public function testAssertConstAmountCurrency() |
||
68 | |||
69 | /** |
||
70 | * MoipTest creating an order. |
||
71 | */ |
||
72 | public function testCreateOrder() |
||
73 | { |
||
74 | $order_created = $this->executeOrder(); |
||
75 | |||
76 | $this->assertEquals($this->last_ord_id, $order_created->getOwnId()); |
||
77 | $this->assertEquals('CREATED', $order_created->getStatus()); |
||
78 | $this->assertEquals(new \DateTime('2016-02-19T12:24:55.849-02'), $order_created->getCreatedAt()); |
||
79 | $this->assertEquals(new \DateTime('2016-02-19T12:24:55.849-02'), $order_created->getUpdatedAt()); |
||
80 | } |
||
81 | |||
82 | /** |
||
83 | * Tests if created items price are correct. |
||
84 | */ |
||
85 | public function testItems() |
||
92 | |||
93 | /** |
||
94 | * Test if created order shipping address is correct. |
||
95 | */ |
||
96 | public function testShippingAddress() |
||
97 | { |
||
98 | $order_created = $this->executeOrder(); |
||
99 | |||
100 | $this->assertEquals('01234000', $order_created->getCustomer()->getShippingAddress()->{'zipCode'}); |
||
101 | $this->assertEquals('Avenida Faria Lima', $order_created->getCustomer()->getShippingAddress()->{'street'}); |
||
102 | $this->assertEquals('2927', $order_created->getCustomer()->getShippingAddress()->{'streetNumber'}); |
||
103 | $this->assertEquals('8', $order_created->getCustomer()->getShippingAddress()->{'complement'}); |
||
104 | $this->assertEquals('Sao Paulo', $order_created->getCustomer()->getShippingAddress()->{'city'}); |
||
105 | $this->assertEquals('Itaim', $order_created->getCustomer()->getShippingAddress()->{'district'}); |
||
106 | $this->assertEquals('SP', $order_created->getCustomer()->getShippingAddress()->{'state'}); |
||
107 | $this->assertEquals('BRA', $order_created->getCustomer()->getShippingAddress()->{'country'}); |
||
108 | } |
||
109 | |||
110 | /** |
||
111 | *MoipTest if the total is correct. |
||
112 | */ |
||
113 | public function testTotal() |
||
120 | |||
121 | /** |
||
122 | * MoipTest if the total is equal to the expected total. |
||
123 | */ |
||
124 | public function testTotalConstant() |
||
133 | |||
134 | /** |
||
135 | * MoipTest if order is created with installment preferences. |
||
136 | */ |
||
137 | public function testCreateOrderWithInstallmentPreferences() |
||
147 | |||
148 | public function testCreateOrderAddingReceiverNoAmount() |
||
154 | |||
155 | public function testCreateOrderAddingReceiverAmountFixed() |
||
161 | |||
162 | public function testCreateOrderAddingReceiverAmountPercentual() |
||
168 | |||
169 | public function testCreateOrderAddingReceiverFeePayor() |
||
180 | } |
||
181 |