@@ -400,9 +400,7 @@ public function testGettingProductImagesReturnsCollectionOfProductImages()
400400
401401 $ collection = Client::getProductImages (1 );
402402 $ this ->assertInternalType ('array ' , $ collection );
403- foreach ($ collection as $ resource ) {
404- $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\ProductImage ' , $ resource );
405- }
403+ $ this ->assertContainsOnlyInstancesOf ('Bigcommerce \\Api \\Resources \\ProductImage ' , $ collection );
406404 }
407405
408406 public function testGettingProductCustomFieldsReturnsCollectionOfProductCustomFields ()
@@ -419,6 +417,17 @@ public function testGettingProductCustomFieldsReturnsCollectionOfProductCustomFi
419417 }
420418 }
421419
420+ public function testGettingASpecifiedProductImageReturnsThatProductImage ()
421+ {
422+ $ this ->connection ->expects ($ this ->once ())
423+ ->method ('get ' )
424+ ->with ($ this ->basePath . '/products/1/images/1 ' , false )
425+ ->will ($ this ->returnValue (array (array (), array ())));
426+
427+ $ resource = Client::getProductImage (1 , 1 );
428+ $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\ProductImage ' , $ resource );
429+ }
430+
422431 public function testGettingASpecifiedProductCustomFieldReturnsThatProductCustomField ()
423432 {
424433 $ this ->connection ->expects ($ this ->once ())
@@ -496,6 +505,15 @@ public function testCreatingAnOptionSetOptionPostsToTheOptionSetsOptionsResource
496505 Client::createOptionSetOption (array (), 1 );
497506 }
498507
508+ public function testCreatingAProductImagePostsToTheProductImageResource ()
509+ {
510+ $ this ->connection ->expects ($ this ->once ())
511+ ->method ('post ' )
512+ ->with ($ this ->basePath . '/products/1/images ' , (object )array ());
513+
514+ Client::createProductImage (1 , array ());
515+ }
516+
499517 public function testCreatingAProductCustomFieldPostsToTheProductCustomFieldResource ()
500518 {
501519 $ this ->connection ->expects ($ this ->once ())
@@ -505,6 +523,15 @@ public function testCreatingAProductCustomFieldPostsToTheProductCustomFieldResou
505523 Client::createProductCustomField (1 , array ());
506524 }
507525
526+ public function testUpdatingAProductImagePutsToTheProductImageResource ()
527+ {
528+ $ this ->connection ->expects ($ this ->once ())
529+ ->method ('put ' )
530+ ->with ($ this ->basePath . '/products/1/images/1 ' , (object )array ());
531+
532+ Client::updateProductImage (1 , 1 , array ());
533+ }
534+
508535 public function testUpdatingAProductCustomFieldPutsToTheProductCustomFieldResource ()
509536 {
510537 $ this ->connection ->expects ($ this ->once ())
@@ -514,6 +541,15 @@ public function testUpdatingAProductCustomFieldPutsToTheProductCustomFieldResour
514541 Client::updateProductCustomField (1 , 1 , array ());
515542 }
516543
544+ public function testDeletingAProductImageDeletesToTheProductImageResource ()
545+ {
546+ $ this ->connection ->expects ($ this ->once ())
547+ ->method ('delete ' )
548+ ->with ($ this ->basePath . '/products/1/images/1 ' );
549+
550+ Client::deleteProductImage (1 , 1 );
551+ }
552+
517553 public function testDeletingAProductCustomFieldDeletesToTheProductCustomFieldResource ()
518554 {
519555 $ this ->connection ->expects ($ this ->once ())
0 commit comments