@@ -14,7 +14,7 @@ class ClientTest extends TestCase
1414 private $ connection ;
1515 private $ basePath = '' ;
1616
17- public function setUp ()
17+ public function setUp (): void
1818 {
1919 $ methods = array (
2020 'useXml ' ,
@@ -37,15 +37,15 @@ public function setUp()
3737 'getHeaders ' ,
3838 '__destruct '
3939 );
40- $ this ->basePath = $ this -> getStaticAttribute ( ' Bigcommerce \\ Api \\ Client ' , ' api_path ' ) ;
40+ $ this ->basePath = Client:: $ api_path ;
4141 $ this ->connection = $ this ->getMockBuilder ('Bigcommerce \\Api \\Connection ' )
4242 ->disableOriginalConstructor ()
4343 ->setMethods ($ methods )
4444 ->getMock ();
4545 Client::setConnection ($ this ->connection );
4646 }
4747
48- public function tearDown ()
48+ public function tearDown (): void
4949 {
5050 Client::configure (array ('username ' => '' , 'api_key ' => '' , 'store_url ' => '' ));
5151 unset($ this ->connection );
@@ -138,7 +138,9 @@ public function testGetCustomerLoginTokenReturnsValidLoginToken()
138138 );
139139 $ token = Client::getCustomerLoginToken (1 );
140140 $ 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+ }
142144 }
143145
144146 public function testGetCustomerLoginTokenThrowsIfNoClientSecret ()
@@ -189,7 +191,7 @@ public function testGetCollectionReturnsCollectionOfSpecifiedTypes()
189191 Client::configure (array ('store_url ' => 'http://storeurl ' , 'username ' => 'whatever ' , 'api_key ' => 'whatever ' ));
190192 Client::setConnection ($ this ->connection ); // re-set the connection since Client::configure unsets it
191193 $ resources = Client::getCollection ('/whatever ' );
192- $ this ->assertInternalType ( ' array ' , $ resources );
194+ $ this ->assertIsArray ( $ resources );
193195 foreach ($ resources as $ resource ) {
194196 $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resource ' , $ resource );
195197 }
@@ -308,7 +310,7 @@ public function testGettingASpecificResourceReturnsACollectionOfThatResource($pa
308310 ->will ($ this ->returnValue (array (array (), array ())));
309311
310312 $ collection = Client::$ fnName ();
311- $ this ->assertInternalType ( ' array ' , $ collection );
313+ $ this ->assertIsArray ( $ collection );
312314 foreach ($ collection as $ resource ) {
313315 $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\' . $ class , $ resource );
314316 }
@@ -438,7 +440,7 @@ public function testGettingProductImagesReturnsCollectionOfProductImages()
438440 ->will ($ this ->returnValue (array (array (), array ())));
439441
440442 $ collection = Client::getProductImages (1 );
441- $ this ->assertInternalType ( ' array ' , $ collection );
443+ $ this ->assertIsArray ( $ collection );
442444 $ this ->assertContainsOnlyInstancesOf ('Bigcommerce \\Api \\Resources \\ProductImage ' , $ collection );
443445 }
444446
@@ -450,7 +452,7 @@ public function testGettingProductCustomFieldsReturnsCollectionOfProductCustomFi
450452 ->will ($ this ->returnValue (array (array (), array ())));
451453
452454 $ collection = Client::getProductCustomFields (1 );
453- $ this ->assertInternalType ( ' array ' , $ collection );
455+ $ this ->assertIsArray ( $ collection );
454456 foreach ($ collection as $ resource ) {
455457 $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\ProductCustomField ' , $ resource );
456458 }
@@ -497,7 +499,7 @@ public function testGettingCustomerAddressesReturnsCollectionOfCustomerAddresses
497499 ->will ($ this ->returnValue (array (array (), array ())));
498500
499501 $ collection = Client::getCustomerAddresses (1 );
500- $ this ->assertInternalType ( ' array ' , $ collection );
502+ $ this ->assertIsArray ( $ collection );
501503 foreach ($ collection as $ resource ) {
502504 $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\Address ' , $ resource );
503505 }
@@ -511,7 +513,7 @@ public function testGettingOptionValuesReturnsCollectionOfOptionValues()
511513 ->will ($ this ->returnValue (array (array (), array ())));
512514
513515 $ collection = Client::getOptionValues ();
514- $ this ->assertInternalType ( ' array ' , $ collection );
516+ $ this ->assertIsArray ( $ collection );
515517 foreach ($ collection as $ resource ) {
516518 $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\OptionValue ' , $ resource );
517519 }
@@ -713,7 +715,7 @@ public function testGettingOrderProductsReturnsTheOrderProductsCollection()
713715 ->will ($ this ->returnValue (array (array (), array ())));
714716
715717 $ collection = Client::getOrderProducts (1 );
716- $ this ->assertInternalType ( ' array ' , $ collection );
718+ $ this ->assertIsArray ( $ collection );
717719 foreach ($ collection as $ resource ) {
718720 $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\OrderProduct ' , $ resource );
719721 }
@@ -727,7 +729,7 @@ public function testGettingOrderShipmentsReturnsTheOrderShipmentsResource()
727729 ->will ($ this ->returnValue (array (array (), array ())));
728730
729731 $ collection = Client::getShipments (1 );
730- $ this ->assertInternalType ( ' array ' , $ collection );
732+ $ this ->assertIsArray ( $ collection );
731733 foreach ($ collection as $ resource ) {
732734 $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\Shipment ' , $ resource );
733735 }
@@ -788,7 +790,7 @@ public function testGettingOrderShippingAddressesReturnsTheAddressResource()
788790 ->will ($ this ->returnValue (array (array (), array ())));
789791
790792 $ collection = Client::getOrderShippingAddresses (1 );
791- $ this ->assertInternalType ( ' array ' , $ collection );
793+ $ this ->assertIsArray ( $ collection );
792794 foreach ($ collection as $ resource ) {
793795 $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\Address ' , $ resource );
794796 }
@@ -858,7 +860,7 @@ public function testGettingWebhooksReturnsAllWebhooks()
858860 ->with ($ this ->basePath . '/hooks ' , false )
859861 ->will ($ this ->returnValue (array (new \Bigcommerce \Api \Resource (),new \Bigcommerce \Api \Resource ())));
860862 $ collection = Client::listWebhooks ();
861- $ this ->assertInternalType ( ' array ' , $ collection );
863+ $ this ->assertIsArray ( $ collection );
862864 foreach ($ collection as $ resource ) {
863865 $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resource ' , $ resource );
864866 }
0 commit comments