2
2
3
3
use KeithBrink \AmazonMws \AmazonFinancialGroupList ;
4
4
5
- class AmazonFinancialGroupListTest extends PHPUnit_Framework_TestCase {
6
-
5
+ class AmazonFinancialGroupListTest extends PHPUnit_Framework_TestCase
6
+ {
7
7
/**
8
8
* @var AmazonFinancialGroupList
9
9
*/
@@ -13,23 +13,26 @@ class AmazonFinancialGroupListTest extends PHPUnit_Framework_TestCase {
13
13
* Sets up the fixture, for example, opens a network connection.
14
14
* This method is called before a test is executed.
15
15
*/
16
- protected function setUp () {
16
+ protected function setUp ()
17
+ {
17
18
resetLog ();
18
19
$ this ->object = new AmazonFinancialGroupList ('testStore ' , true , null );
19
20
}
20
21
21
- public function testSetUseToken (){
22
+ public function testSetUseToken ()
23
+ {
22
24
$ this ->assertNull ($ this ->object ->setUseToken ());
23
25
$ this ->assertNull ($ this ->object ->setUseToken (true ));
24
26
$ this ->assertNull ($ this ->object ->setUseToken (false ));
25
27
$ this ->assertFalse ($ this ->object ->setUseToken ('wrong ' ));
26
28
}
27
29
28
- public function testSetMaxResultsPerPage (){
30
+ public function testSetMaxResultsPerPage ()
31
+ {
29
32
$ this ->assertFalse ($ this ->object ->setMaxResultsPerPage (null )); //can't be nothing
30
33
$ this ->assertFalse ($ this ->object ->setMaxResultsPerPage (-5 )); //too low
31
34
$ this ->assertFalse ($ this ->object ->setMaxResultsPerPage (150 )); //too high
32
- $ this ->assertFalse ($ this ->object ->setMaxResultsPerPage (array ( 5 , 7 ) )); //not a valid value
35
+ $ this ->assertFalse ($ this ->object ->setMaxResultsPerPage ([ 5 , 7 ] )); //not a valid value
33
36
$ this ->assertFalse ($ this ->object ->setMaxResultsPerPage ('banana ' )); //what are you even doing
34
37
$ this ->assertNull ($ this ->object ->setMaxResultsPerPage (77 ));
35
38
$ this ->assertNull ($ this ->object ->setMaxResultsPerPage ('75 ' ));
@@ -39,23 +42,25 @@ public function testSetMaxResultsPerPage(){
39
42
}
40
43
41
44
/**
42
- * @return array
43
- */
44
- public function timeProvider () {
45
- return array (
46
- array (null , null , false , false ), //nothing given, so no change
47
- array (time (), time (), true , true ), //timestamps
48
- array ('' , '' , false , false ), //strings, but empty
49
- array ('-1 min ' , null , true , false ), //one set
50
- array (null , '-1 min ' , false , false ), //other set
51
- array ('-1 min ' , '-1 min ' , true , true ), //both set
52
- );
45
+ * @return array
46
+ */
47
+ public function timeProvider ()
48
+ {
49
+ return [
50
+ [null , null , false , false ], //nothing given, so no change
51
+ [time (), time (), true , true ], //timestamps
52
+ ['' , '' , false , false ], //strings, but empty
53
+ ['-1 min ' , null , true , false ], //one set
54
+ [null , '-1 min ' , false , false ], //other set
55
+ ['-1 min ' , '-1 min ' , true , true ], //both set
56
+ ];
53
57
}
54
58
55
59
/**
56
60
* @dataProvider timeProvider
57
61
*/
58
- public function testSetTimeLimits ($ a , $ b , $ c , $ d ){
62
+ public function testSetTimeLimits ($ a , $ b , $ c , $ d )
63
+ {
59
64
$ try = $ this ->object ->setTimeLimits ($ a , $ b );
60
65
$ o = $ this ->object ->getOptions ();
61
66
if ($ c ) {
@@ -79,7 +84,8 @@ public function testSetTimeLimits($a, $b, $c, $d){
79
84
}
80
85
}
81
86
82
- public function testFetchGroupList () {
87
+ public function testFetchGroupList ()
88
+ {
83
89
resetLog ();
84
90
$ this ->object ->setMock (true , 'fetchFinancialGroups.xml ' ); //no token
85
91
$ this ->assertFalse ($ this ->object ->fetchGroupList ()); //no date yet
@@ -99,7 +105,8 @@ public function testFetchGroupList() {
99
105
return $ this ->object ;
100
106
}
101
107
102
- public function testFetchGroupListToken1 () {
108
+ public function testFetchGroupListToken1 ()
109
+ {
103
110
resetLog ();
104
111
$ this ->object ->setMock (true , 'fetchFinancialGroupsToken.xml ' );
105
112
//without using token
@@ -117,9 +124,10 @@ public function testFetchGroupListToken1() {
117
124
$ this ->assertCount (1 , $ r );
118
125
}
119
126
120
- public function testFetchGroupListToken2 () {
127
+ public function testFetchGroupListToken2 ()
128
+ {
121
129
resetLog ();
122
- $ this ->object ->setMock (true , array ( 'fetchFinancialGroupsToken.xml ' , 'fetchFinancialGroupsToken2.xml ' ) );
130
+ $ this ->object ->setMock (true , [ 'fetchFinancialGroupsToken.xml ' , 'fetchFinancialGroupsToken2.xml ' ] );
123
131
124
132
//with using token
125
133
$ this ->object ->setUseToken ();
@@ -144,7 +152,8 @@ public function testFetchGroupListToken2() {
144
152
* @param AmazonFinancialGroupList $o
145
153
* @depends testFetchGroupList
146
154
*/
147
- public function testGetGroups ($ o ) {
155
+ public function testGetGroups ($ o )
156
+ {
148
157
$ list = $ o ->getGroups ();
149
158
$ this ->assertInternalType ('array ' , $ list );
150
159
$ this ->assertCount (2 , $ list );
@@ -180,7 +189,8 @@ public function testGetGroups($o) {
180
189
* @param AmazonFinancialGroupList $o
181
190
* @depends testFetchGroupList
182
191
*/
183
- public function testGetGroupId ($ o ) {
192
+ public function testGetGroupId ($ o )
193
+ {
184
194
$ this ->assertEquals ('22YgYW55IGNhcm5hbCBwbGVhEXAMPLE ' , $ o ->getGroupId (0 ));
185
195
$ this ->assertEquals ('22Y99995IGNhcm5hbANOTHEREXAMPLE ' , $ o ->getGroupId (1 ));
186
196
$ this ->assertEquals ($ o ->getGroupId (0 ), $ o ->getGroupId ());
@@ -192,7 +202,8 @@ public function testGetGroupId($o) {
192
202
* @param AmazonFinancialGroupList $o
193
203
* @depends testFetchGroupList
194
204
*/
195
- public function testGetProcessingStatus ($ o ) {
205
+ public function testGetProcessingStatus ($ o )
206
+ {
196
207
$ this ->assertEquals ('Closed ' , $ o ->getProcessingStatus (0 ));
197
208
$ this ->assertEquals ('Closed2 ' , $ o ->getProcessingStatus (1 ));
198
209
$ this ->assertEquals ($ o ->getProcessingStatus (0 ), $ o ->getProcessingStatus ());
@@ -204,7 +215,8 @@ public function testGetProcessingStatus($o) {
204
215
* @param AmazonFinancialGroupList $o
205
216
* @depends testFetchGroupList
206
217
*/
207
- public function testGetTransferStatus ($ o ) {
218
+ public function testGetTransferStatus ($ o )
219
+ {
208
220
$ this ->assertEquals ('Successful ' , $ o ->getTransferStatus (0 ));
209
221
$ this ->assertEquals ('Successful2 ' , $ o ->getTransferStatus (1 ));
210
222
$ this ->assertEquals ($ o ->getTransferStatus (0 ), $ o ->getTransferStatus ());
@@ -216,11 +228,12 @@ public function testGetTransferStatus($o) {
216
228
* @param AmazonFinancialGroupList $o
217
229
* @depends testFetchGroupList
218
230
*/
219
- public function testGetOriginalTotal ($ o ) {
220
- $ x0 = array ();
231
+ public function testGetOriginalTotal ($ o )
232
+ {
233
+ $ x0 = [];
221
234
$ x0 ['Amount ' ] = '19.00 ' ;
222
235
$ x0 ['CurrencyCode ' ] = 'USD ' ;
223
- $ x1 = array () ;
236
+ $ x1 = [] ;
224
237
$ x1 ['Amount ' ] = '42.00 ' ;
225
238
$ x1 ['CurrencyCode ' ] = 'USD ' ;
226
239
$ this ->assertEquals ($ x0 , $ o ->getOriginalTotal (0 ));
@@ -236,11 +249,12 @@ public function testGetOriginalTotal($o) {
236
249
* @param AmazonFinancialGroupList $o
237
250
* @depends testFetchGroupList
238
251
*/
239
- public function testGetConvertedTotal ($ o ) {
240
- $ x0 = array ();
252
+ public function testGetConvertedTotal ($ o )
253
+ {
254
+ $ x0 = [];
241
255
$ x0 ['Amount ' ] = '19.50 ' ;
242
256
$ x0 ['CurrencyCode ' ] = 'USD ' ;
243
- $ x1 = array () ;
257
+ $ x1 = [] ;
244
258
$ x1 ['Amount ' ] = '42.50 ' ;
245
259
$ x1 ['CurrencyCode ' ] = 'USD ' ;
246
260
$ this ->assertEquals ($ x0 , $ o ->getConvertedTotal (0 ));
@@ -256,7 +270,8 @@ public function testGetConvertedTotal($o) {
256
270
* @param AmazonFinancialGroupList $o
257
271
* @depends testFetchGroupList
258
272
*/
259
- public function testGetTransferDate ($ o ) {
273
+ public function testGetTransferDate ($ o )
274
+ {
260
275
$ this ->assertEquals ('2014-09-09T01:30:00.000-06:00 ' , $ o ->getTransferDate (0 ));
261
276
$ this ->assertEquals ('2014-10-09T01:30:00.000-06:00 ' , $ o ->getTransferDate (1 ));
262
277
$ this ->assertEquals ($ o ->getTransferDate (0 ), $ o ->getTransferDate ());
@@ -268,7 +283,8 @@ public function testGetTransferDate($o) {
268
283
* @param AmazonFinancialGroupList $o
269
284
* @depends testFetchGroupList
270
285
*/
271
- public function testGetTraceId ($ o ) {
286
+ public function testGetTraceId ($ o )
287
+ {
272
288
$ this ->assertEquals ('128311029381HSADJEXAMPLE ' , $ o ->getTraceId (0 ));
273
289
$ this ->assertEquals ('128999929381HADJEXAMPLE2 ' , $ o ->getTraceId (1 ));
274
290
$ this ->assertEquals ($ o ->getTraceId (0 ), $ o ->getTraceId ());
@@ -280,7 +296,8 @@ public function testGetTraceId($o) {
280
296
* @param AmazonFinancialGroupList $o
281
297
* @depends testFetchGroupList
282
298
*/
283
- public function testGetAccountTail ($ o ) {
299
+ public function testGetAccountTail ($ o )
300
+ {
284
301
$ this ->assertEquals ('1212 ' , $ o ->getAccountTail (0 ));
285
302
$ this ->assertEquals ('1313 ' , $ o ->getAccountTail (1 ));
286
303
$ this ->assertEquals ($ o ->getAccountTail (0 ), $ o ->getAccountTail ());
@@ -292,11 +309,12 @@ public function testGetAccountTail($o) {
292
309
* @param AmazonFinancialGroupList $o
293
310
* @depends testFetchGroupList
294
311
*/
295
- public function testGetBeginningBalance ($ o ) {
296
- $ x0 = array ();
312
+ public function testGetBeginningBalance ($ o )
313
+ {
314
+ $ x0 = [];
297
315
$ x0 ['Amount ' ] = '0.00 ' ;
298
316
$ x0 ['CurrencyCode ' ] = 'USD ' ;
299
- $ x1 = array () ;
317
+ $ x1 = [] ;
300
318
$ x1 ['Amount ' ] = '20.00 ' ;
301
319
$ x1 ['CurrencyCode ' ] = 'USD ' ;
302
320
$ this ->assertEquals ($ x0 , $ o ->getBeginningBalance (0 ));
@@ -312,7 +330,8 @@ public function testGetBeginningBalance($o) {
312
330
* @param AmazonFinancialGroupList $o
313
331
* @depends testFetchGroupList
314
332
*/
315
- public function testGetStartDate ($ o ) {
333
+ public function testGetStartDate ($ o )
334
+ {
316
335
$ this ->assertEquals ('2014-09-01T01:30:00.000-06:00 ' , $ o ->getStartDate (0 ));
317
336
$ this ->assertEquals ('2014-10-01T01:30:00.000-06:00 ' , $ o ->getStartDate (1 ));
318
337
$ this ->assertEquals ($ o ->getStartDate (0 ), $ o ->getStartDate ());
@@ -324,14 +343,14 @@ public function testGetStartDate($o) {
324
343
* @param AmazonFinancialGroupList $o
325
344
* @depends testFetchGroupList
326
345
*/
327
- public function testGetEndDate ($ o ) {
346
+ public function testGetEndDate ($ o )
347
+ {
328
348
$ this ->assertEquals ('2014-09-09T01:30:00.000-06:00 ' , $ o ->getEndDate (0 ));
329
349
$ this ->assertEquals ('2014-10-09T01:30:00.000-06:00 ' , $ o ->getEndDate (1 ));
330
350
$ this ->assertEquals ($ o ->getEndDate (0 ), $ o ->getEndDate ());
331
351
//not fetched yet for this object
332
352
$ this ->assertFalse ($ this ->object ->getEndDate ());
333
353
}
334
-
335
354
}
336
355
337
356
require_once __DIR__ .'/../helperFunctions.php ' ;
0 commit comments