@@ -303,15 +303,15 @@ public function testGettingTheCountOfACollectionReturnsThatCollectionsCount($pat
303303 public function resources ()
304304 {
305305 return array (
306- // path function classname
307- array ('products ' , '%sProduct ' , 'Product ' ),
308- array ('brands ' , '%sBrand ' , 'Brand ' ),
309- array ('orders ' , '%sOrder ' , 'Order ' ),
310- array ('customers ' , '%sCustomer ' , 'Customer ' ),
311- array ('categories ' , '%sCategory ' , 'Category ' ),
312- array ('options ' , '%sOption ' , 'Option ' ),
313- array ('optionsets ' , '%sOptionSet ' , 'OptionSet ' ),
314- array ('coupons ' , '%sCoupon ' , 'Coupon ' ),
306+ // path function classname
307+ array ('products ' , '%sProduct ' , 'Product ' ),
308+ array ('brands ' , '%sBrand ' , 'Brand ' ),
309+ array ('orders ' , '%sOrder ' , 'Order ' ),
310+ array ('customers ' , '%sCustomer ' , 'Customer ' ),
311+ array ('categories ' , '%sCategory ' , 'Category ' ),
312+ array ('options ' , '%sOption ' , 'Option ' ),
313+ array ('optionsets ' , '%sOptionSet ' , 'OptionSet ' ),
314+ array ('coupons ' , '%sCoupon ' , 'Coupon ' ),
315315 );
316316 }
317317
@@ -320,10 +320,6 @@ public function resources()
320320 */
321321 public function testGettingASpecificResourceReturnsThatResource ($ path , $ fnName , $ class )
322322 {
323- if (in_array ($ path , array ('coupons ' ))) {
324- $ this ->markTestSkipped (sprintf ('The php client does not support getting a specified %s ' , $ path ));
325- }
326-
327323 $ this ->connection ->expects ($ this ->once ())
328324 ->method ('get ' )
329325 ->with ($ this ->basePath . '/ ' . $ path . '/1 ' , false )
@@ -339,10 +335,6 @@ public function testGettingASpecificResourceReturnsThatResource($path, $fnName,
339335 */
340336 public function testCreatingASpecificResourcePostsToThatResource ($ path , $ fnName , $ class )
341337 {
342- if (in_array ($ path , array ('options ' , 'optionsets ' ))) {
343- $ this ->markTestSkipped (sprintf ('The php client does not support creating a specified %s ' , $ path ));
344- }
345-
346338 $ this ->connection ->expects ($ this ->once ())
347339 ->method ('post ' )
348340 ->with ($ this ->basePath . '/ ' . $ path , (object )array ());
@@ -356,10 +348,6 @@ public function testCreatingASpecificResourcePostsToThatResource($path, $fnName,
356348 */
357349 public function testDeletingASpecificResourceDeletesToThatResource ($ path , $ fnName , $ class )
358350 {
359- if (in_array ($ path , array ('optionsets ' , 'coupons ' ))) {
360- $ this ->markTestSkipped (sprintf ('The php client does not support deleting a specified %s ' , $ path ));
361- }
362-
363351 $ this ->connection ->expects ($ this ->once ())
364352 ->method ('delete ' )
365353 ->with ($ this ->basePath . '/ ' . $ path . '/1 ' );
@@ -373,10 +361,6 @@ public function testDeletingASpecificResourceDeletesToThatResource($path, $fnNam
373361 */
374362 public function testUpdatingASpecificResourcePutsToThatResource ($ path , $ fnName , $ class )
375363 {
376- if (in_array ($ path , array ('orders ' , 'options ' , 'optionsets ' ))) {
377- $ this ->markTestSkipped (sprintf ('The php client does not support updating a specified %s ' , $ path ));
378- }
379-
380364 $ this ->connection ->expects ($ this ->once ())
381365 ->method ('put ' )
382366 ->with ($ this ->basePath . '/ ' . $ path . '/1 ' );
@@ -488,7 +472,7 @@ public function testCreatingAnOptionSetPostsToTheOptionSetsResource()
488472 ->method ('post ' )
489473 ->with ($ this ->basePath . '/optionsets ' , (object )array ());
490474
491- Client::createOptionsets (array ());
475+ Client::createOptionSet (array ());
492476 }
493477
494478 public function testCreatingAnOptionPostsToTheOptionResource ()
@@ -497,16 +481,16 @@ public function testCreatingAnOptionPostsToTheOptionResource()
497481 ->method ('post ' )
498482 ->with ($ this ->basePath . '/options ' , (object )array ());
499483
500- Client::createOptions (array ());
484+ Client::createOption (array ());
501485 }
502486
503- public function testCreatingAnOptionSetsOptionPostsToTheOptionSetsOptionResource ()
487+ public function testCreatingAnOptionSetOptionPostsToTheOptionSetsOptionsResource ()
504488 {
505489 $ this ->connection ->expects ($ this ->once ())
506490 ->method ('post ' )
507491 ->with ($ this ->basePath . '/optionsets/1/options ' , (object )array ());
508492
509- Client::createOptionsetsOptions (array (), 1 );
493+ Client::createOptionSetOption (array (), 1 );
510494 }
511495
512496 public function testCreatingAProductCustomFieldPostsToTheProductCustomFieldResource ()
@@ -594,6 +578,33 @@ public function testDeletingAllOrdersDeletesToTheOrderResource()
594578 Client::deleteAllOrders ();
595579 }
596580
581+ public function testDeletingAllBrandsDeletesToTheBrandsResource ()
582+ {
583+ $ this ->connection ->expects ($ this ->once ())
584+ ->method ('delete ' )
585+ ->with ($ this ->basePath . '/brands ' );
586+
587+ Client::deleteAllBrands ();
588+ }
589+
590+ public function testDeletingAllCategoriesDeletesToTheCategoriesResource ()
591+ {
592+ $ this ->connection ->expects ($ this ->once ())
593+ ->method ('delete ' )
594+ ->with ($ this ->basePath . '/categories ' );
595+
596+ Client::deleteAllCategories ();
597+ }
598+
599+ public function testDeletingAllProductsDeletesToTheProductsResource ()
600+ {
601+ $ this ->connection ->expects ($ this ->once ())
602+ ->method ('delete ' )
603+ ->with ($ this ->basePath . '/products ' );
604+
605+ Client::deleteAllProducts ();
606+ }
607+
597608 public function testGettingOrderProductsCountCountsToTheOrderProductsResource ()
598609 {
599610 $ this ->connection ->expects ($ this ->once ())
@@ -616,6 +627,20 @@ public function testGettingOrderShipmentReturnsTheOrderShipmentResource()
616627 $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\Shipment ' , $ resource );
617628 }
618629
630+ public function testGettingOrderProductsReturnsTheOrderProductsCollection ()
631+ {
632+ $ this ->connection ->expects ($ this ->once ())
633+ ->method ('get ' )
634+ ->with ($ this ->basePath . '/orders/1/products ' , false )
635+ ->will ($ this ->returnValue (array (array (), array ())));
636+
637+ $ collection = Client::getOrderProducts (1 );
638+ $ this ->assertInternalType ('array ' , $ collection );
639+ foreach ($ collection as $ resource ) {
640+ $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\OrderProduct ' , $ resource );
641+ }
642+ }
643+
619644 public function testGettingOrderShipmentsReturnsTheOrderShipmentsResource ()
620645 {
621646 $ this ->connection ->expects ($ this ->once ())
0 commit comments