@@ -286,8 +286,9 @@ public function testGettingASpecificResourceReturnsACollectionOfThatResource($pa
286286 */
287287 public function testGettingTheCountOfACollectionReturnsThatCollectionsCount ($ path , $ fnName , $ class )
288288 {
289- if (in_array ($ path , array ('order_statuses ' , 'products/skus ' , 'requestlogs ' ))) {
290- $ this ->markTestSkipped (sprintf ('The PHP client does not support getting the count of %s ' , $ path ));
289+ if (in_array ($ path , array ('order_statuses ' , 'requestlogs ' ))) {
290+ //$this->markTestSkipped(sprintf('The API does not currently support getting the count of %s', $path));
291+ return ;
291292 }
292293
293294 $ this ->connection ->expects ($ this ->once ())
@@ -303,15 +304,15 @@ public function testGettingTheCountOfACollectionReturnsThatCollectionsCount($pat
303304 public function resources ()
304305 {
305306 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 ' ),
307+ // path function classname
308+ array ('products ' , '%sProduct ' , 'Product ' ),
309+ array ('brands ' , '%sBrand ' , 'Brand ' ),
310+ array ('orders ' , '%sOrder ' , 'Order ' ),
311+ array ('customers ' , '%sCustomer ' , 'Customer ' ),
312+ array ('categories ' , '%sCategory ' , 'Category ' ),
313+ array ('options ' , '%sOption ' , 'Option ' ),
314+ array ('optionsets ' , '%sOptionSet ' , 'OptionSet ' ),
315+ array ('coupons ' , '%sCoupon ' , 'Coupon ' ),
315316 );
316317 }
317318
@@ -320,10 +321,6 @@ public function resources()
320321 */
321322 public function testGettingASpecificResourceReturnsThatResource ($ path , $ fnName , $ class )
322323 {
323- if (in_array ($ path , array ('coupons ' ))) {
324- $ this ->markTestSkipped (sprintf ('The php client does not support getting a specified %s ' , $ path ));
325- }
326-
327324 $ this ->connection ->expects ($ this ->once ())
328325 ->method ('get ' )
329326 ->with ($ this ->basePath . '/ ' . $ path . '/1 ' , false )
@@ -339,10 +336,6 @@ public function testGettingASpecificResourceReturnsThatResource($path, $fnName,
339336 */
340337 public function testCreatingASpecificResourcePostsToThatResource ($ path , $ fnName , $ class )
341338 {
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-
346339 $ this ->connection ->expects ($ this ->once ())
347340 ->method ('post ' )
348341 ->with ($ this ->basePath . '/ ' . $ path , (object )array ());
@@ -356,10 +349,6 @@ public function testCreatingASpecificResourcePostsToThatResource($path, $fnName,
356349 */
357350 public function testDeletingASpecificResourceDeletesToThatResource ($ path , $ fnName , $ class )
358351 {
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-
363352 $ this ->connection ->expects ($ this ->once ())
364353 ->method ('delete ' )
365354 ->with ($ this ->basePath . '/ ' . $ path . '/1 ' );
@@ -373,10 +362,6 @@ public function testDeletingASpecificResourceDeletesToThatResource($path, $fnNam
373362 */
374363 public function testUpdatingASpecificResourcePutsToThatResource ($ path , $ fnName , $ class )
375364 {
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-
380365 $ this ->connection ->expects ($ this ->once ())
381366 ->method ('put ' )
382367 ->with ($ this ->basePath . '/ ' . $ path . '/1 ' );
@@ -488,7 +473,7 @@ public function testCreatingAnOptionSetPostsToTheOptionSetsResource()
488473 ->method ('post ' )
489474 ->with ($ this ->basePath . '/optionsets ' , (object )array ());
490475
491- Client::createOptionsets (array ());
476+ Client::createOptionSet (array ());
492477 }
493478
494479 public function testCreatingAnOptionPostsToTheOptionResource ()
@@ -497,16 +482,16 @@ public function testCreatingAnOptionPostsToTheOptionResource()
497482 ->method ('post ' )
498483 ->with ($ this ->basePath . '/options ' , (object )array ());
499484
500- Client::createOptions (array ());
485+ Client::createOption (array ());
501486 }
502487
503- public function testCreatingAnOptionSetsOptionPostsToTheOptionSetsOptionResource ()
488+ public function testCreatingAnOptionSetOptionPostsToTheOptionSetsOptionsResource ()
504489 {
505490 $ this ->connection ->expects ($ this ->once ())
506491 ->method ('post ' )
507492 ->with ($ this ->basePath . '/optionsets/1/options ' , (object )array ());
508493
509- Client::createOptionsetsOptions (array (), 1 );
494+ Client::createOptionSetOption (array (), 1 );
510495 }
511496
512497 public function testCreatingAProductCustomFieldPostsToTheProductCustomFieldResource ()
@@ -594,6 +579,33 @@ public function testDeletingAllOrdersDeletesToTheOrderResource()
594579 Client::deleteAllOrders ();
595580 }
596581
582+ public function testDeletingAllBrandsDeletesToTheBrandsResource ()
583+ {
584+ $ this ->connection ->expects ($ this ->once ())
585+ ->method ('delete ' )
586+ ->with ($ this ->basePath . '/brands ' );
587+
588+ Client::deleteAllBrands ();
589+ }
590+
591+ public function testDeletingAllCategoriesDeletesToTheCategoriesResource ()
592+ {
593+ $ this ->connection ->expects ($ this ->once ())
594+ ->method ('delete ' )
595+ ->with ($ this ->basePath . '/categories ' );
596+
597+ Client::deleteAllCategories ();
598+ }
599+
600+ public function testDeletingAllProductsDeletesToTheProductsResource ()
601+ {
602+ $ this ->connection ->expects ($ this ->once ())
603+ ->method ('delete ' )
604+ ->with ($ this ->basePath . '/products ' );
605+
606+ Client::deleteAllProducts ();
607+ }
608+
597609 public function testGettingOrderProductsCountCountsToTheOrderProductsResource ()
598610 {
599611 $ this ->connection ->expects ($ this ->once ())
@@ -616,6 +628,20 @@ public function testGettingOrderShipmentReturnsTheOrderShipmentResource()
616628 $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\Shipment ' , $ resource );
617629 }
618630
631+ public function testGettingOrderProductsReturnsTheOrderProductsCollection ()
632+ {
633+ $ this ->connection ->expects ($ this ->once ())
634+ ->method ('get ' )
635+ ->with ($ this ->basePath . '/orders/1/products ' , false )
636+ ->will ($ this ->returnValue (array (array (), array ())));
637+
638+ $ collection = Client::getOrderProducts (1 );
639+ $ this ->assertInternalType ('array ' , $ collection );
640+ foreach ($ collection as $ resource ) {
641+ $ this ->assertInstanceOf ('Bigcommerce \\Api \\Resources \\OrderProduct ' , $ resource );
642+ }
643+ }
644+
619645 public function testGettingOrderShipmentsReturnsTheOrderShipmentsResource ()
620646 {
621647 $ this ->connection ->expects ($ this ->once ())
0 commit comments