/**
  * {@inheritdoc}
  *
  * @return Basket\BasketSet
  */
 public function createWishListSet(stdClass $jsonObject, array $products)
 {
     return WishList\WishListSet::createFromJson($jsonObject, $this, $products);
 }
 /**
  * @param WishListSet $WishListSet
  *
  * @return $this
  */
 public function updateItemSet(WishListSet $WishListSet)
 {
     $items = $WishListSet->getItems();
     if (empty($items)) {
         throw new \InvalidArgumentException('WishListSet needs at least one item');
     }
     $setItems = [];
     foreach ($items as $subItem) {
         $item = ['variant_id' => $subItem->getVariantId(), 'app_id' => $subItem->getAppId()];
         $additionalData = $subItem->getAdditionalData();
         if (!empty($additionalData)) {
             $this->checkAdditionData($additionalData);
             $item['additional_data'] = (array) $additionalData;
         }
         $setItems[] = $item;
     }
     $set = ['additional_data' => (array) $WishListSet->getAdditionalData(), 'set_items' => $setItems];
     $setId = $WishListSet->getId();
     if ($setId) {
         $set['id'] = $setId;
         $this->updatedItems[$setId] = $set;
     } else {
         $this->updatedItems[] = $set;
     }
     return $this;
 }
 public function testAddItemSetToWishListWithProductID()
 {
     $ay = $this->getAY();
     $WishList = new WishList();
     $set = new WishList\WishListSet('A123567', array('description' => 'test', 'image_url' => 'http://img-url'));
     $item = new WishList\WishListSetItem($this->getProductId(1));
     $set->addItem($item);
     $WishList->updateItemSet($set);
     $result = $ay->updateWishList($this->getSessionId(), $WishList);
     $this->assertTrue($result->hasErrors());
 }