Exemple #1
0
 /**
  * @depends testApiProductList
  */
 public function testApiProductLoad()
 {
     $api_product = new APIProduct(self::$orgConfig);
     try {
         $list = $api_product->listProducts();
     } catch (\Exception $e) {
         $this->fail();
         return;
     }
     $this->assertNotEmpty($list);
     // Pick a random item from the list. No need to shuffle if list has
     // only 1 member.
     if (count($list) > 1) {
         shuffle($list);
     }
     $item = reset($list);
     try {
         $api_product->load($item->getName());
     } catch (\Exception $e) {
         $this->fail($e->getCode() . ': ' . $e->getMessage());
     }
     $this->assertNotEmpty($api_product->getName());
 }