@@ -14,7 +14,7 @@ class ClientTest extends TestCase
14
14
private $ connection ;
15
15
private $ basePath = '' ;
16
16
17
- public function setUp ()
17
+ public function setUp (): void
18
18
{
19
19
$ methods = array (
20
20
'useXml ' ,
@@ -37,15 +37,15 @@ public function setUp()
37
37
'getHeaders ' ,
38
38
'__destruct '
39
39
);
40
- $ this ->basePath = $ this -> getStaticAttribute ( ' Bigcommerce \\ Api \\ Client ' , ' api_path ' ) ;
40
+ $ this ->basePath = Client:: $ api_path ;
41
41
$ this ->connection = $ this ->getMockBuilder ('Bigcommerce \\Api \\Connection ' )
42
42
->disableOriginalConstructor ()
43
43
->setMethods ($ methods )
44
44
->getMock ();
45
45
Client::setConnection ($ this ->connection );
46
46
}
47
47
48
- public function tearDown ()
48
+ public function tearDown (): void
49
49
{
50
50
Client::configure (array ('username ' => '' , 'api_key ' => '' , 'store_url ' => '' ));
51
51
unset($ this ->connection );
@@ -138,7 +138,9 @@ public function testGetCustomerLoginTokenReturnsValidLoginToken()
138
138
);
139
139
$ token = Client::getCustomerLoginToken (1 );
140
140
$ actualPayload = (array )\Firebase \JWT \JWT ::decode ($ token , 'zyx ' , array ('HS256 ' ));
141
- $ this ->assertArraySubset ($ expectedPayload , $ actualPayload );
141
+ foreach ($ expectedPayload as $ value ) {
142
+ $ this ->assertContains ($ value , $ actualPayload );
143
+ }
142
144
}
143
145
144
146
public function testGetCustomerLoginTokenThrowsIfNoClientSecret ()
@@ -189,7 +191,7 @@ public function testGetCollectionReturnsCollectionOfSpecifiedTypes()
189
191
Client::configure (array ('store_url ' => 'http://storeurl ' , 'username ' => 'whatever ' , 'api_key ' => 'whatever ' ));
190
192
Client::setConnection ($ this ->connection ); // re-set the connection since Client::configure unsets it
191
193
$ resources = Client::getCollection ('/whatever ' );
192
- $ this ->assertInternalType ( ' array ' , $ resources );
194
+ $ this ->assertIsArray ( $ resources );
193
195
foreach ($ resources as $ resource ) {
194
196
$ this ->assertInstanceOf ('Bigcommerce \\Api \\Resource ' , $ resource );
195
197
}
@@ -308,7 +310,7 @@ public function testGettingASpecificResourceReturnsACollectionOfThatResource($pa
308
310
->will ($ this ->returnValue (array (array (), array ())));
309
311
310
312
$ collection = Client::$ fnName ();
311
- $ this ->assertInternalType ( ' array ' , $ collection );
313
+ $ this ->assertIsArray ( $ collection );
312
314
foreach ($ collection as $ resource ) {
313
315
$ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\' . $ class , $ resource );
314
316
}
@@ -438,7 +440,7 @@ public function testGettingProductImagesReturnsCollectionOfProductImages()
438
440
->will ($ this ->returnValue (array (array (), array ())));
439
441
440
442
$ collection = Client::getProductImages (1 );
441
- $ this ->assertInternalType ( ' array ' , $ collection );
443
+ $ this ->assertIsArray ( $ collection );
442
444
$ this ->assertContainsOnlyInstancesOf ('Bigcommerce \\Api \\Resources \\ProductImage ' , $ collection );
443
445
}
444
446
@@ -450,7 +452,7 @@ public function testGettingProductCustomFieldsReturnsCollectionOfProductCustomFi
450
452
->will ($ this ->returnValue (array (array (), array ())));
451
453
452
454
$ collection = Client::getProductCustomFields (1 );
453
- $ this ->assertInternalType ( ' array ' , $ collection );
455
+ $ this ->assertIsArray ( $ collection );
454
456
foreach ($ collection as $ resource ) {
455
457
$ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\ProductCustomField ' , $ resource );
456
458
}
@@ -497,7 +499,7 @@ public function testGettingCustomerAddressesReturnsCollectionOfCustomerAddresses
497
499
->will ($ this ->returnValue (array (array (), array ())));
498
500
499
501
$ collection = Client::getCustomerAddresses (1 );
500
- $ this ->assertInternalType ( ' array ' , $ collection );
502
+ $ this ->assertIsArray ( $ collection );
501
503
foreach ($ collection as $ resource ) {
502
504
$ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\Address ' , $ resource );
503
505
}
@@ -511,7 +513,7 @@ public function testGettingOptionValuesReturnsCollectionOfOptionValues()
511
513
->will ($ this ->returnValue (array (array (), array ())));
512
514
513
515
$ collection = Client::getOptionValues ();
514
- $ this ->assertInternalType ( ' array ' , $ collection );
516
+ $ this ->assertIsArray ( $ collection );
515
517
foreach ($ collection as $ resource ) {
516
518
$ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\OptionValue ' , $ resource );
517
519
}
@@ -713,7 +715,7 @@ public function testGettingOrderProductsReturnsTheOrderProductsCollection()
713
715
->will ($ this ->returnValue (array (array (), array ())));
714
716
715
717
$ collection = Client::getOrderProducts (1 );
716
- $ this ->assertInternalType ( ' array ' , $ collection );
718
+ $ this ->assertIsArray ( $ collection );
717
719
foreach ($ collection as $ resource ) {
718
720
$ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\OrderProduct ' , $ resource );
719
721
}
@@ -727,7 +729,7 @@ public function testGettingOrderShipmentsReturnsTheOrderShipmentsResource()
727
729
->will ($ this ->returnValue (array (array (), array ())));
728
730
729
731
$ collection = Client::getShipments (1 );
730
- $ this ->assertInternalType ( ' array ' , $ collection );
732
+ $ this ->assertIsArray ( $ collection );
731
733
foreach ($ collection as $ resource ) {
732
734
$ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\Shipment ' , $ resource );
733
735
}
@@ -788,7 +790,7 @@ public function testGettingOrderShippingAddressesReturnsTheAddressResource()
788
790
->will ($ this ->returnValue (array (array (), array ())));
789
791
790
792
$ collection = Client::getOrderShippingAddresses (1 );
791
- $ this ->assertInternalType ( ' array ' , $ collection );
793
+ $ this ->assertIsArray ( $ collection );
792
794
foreach ($ collection as $ resource ) {
793
795
$ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\Address ' , $ resource );
794
796
}
@@ -858,7 +860,7 @@ public function testGettingWebhooksReturnsAllWebhooks()
858
860
->with ($ this ->basePath . '/hooks ' , false )
859
861
->will ($ this ->returnValue (array (new \Bigcommerce \Api \Resource (),new \Bigcommerce \Api \Resource ())));
860
862
$ collection = Client::listWebhooks ();
861
- $ this ->assertInternalType ( ' array ' , $ collection );
863
+ $ this ->assertIsArray ( $ collection );
862
864
foreach ($ collection as $ resource ) {
863
865
$ this ->assertInstanceOf ('Bigcommerce \\Api \\Resource ' , $ resource );
864
866
}
0 commit comments