コード例 #1
0
 /**
  * @param CustomCollection $collection
  *
  * @return bool
  */
 public function remove(CustomCollection $collection)
 {
     if (null == $collection->getId()) {
         throw new \ErrorException('Can not remove a non existent Product !');
     } else {
         $request = new DeleteJson($this->removeUrl($collection), new CustomCollectionWrapper($collection));
     }
     $deleted = $request->makeRequest();
     return (bool) $deleted;
 }
コード例 #2
0
 public function testCreateAndRemoveANewCustomCollection()
 {
     $collectionImage = new CustomCollectionImage();
     $collectionImage->setSrc('https://www.google.fr/images/srpr/logo11w.png');
     $customCollection = new CustomCollection();
     $customCollection->setImage($collectionImage)->setTitle('Test CustomCollection1')->setBodyHtml('Test Body CustomCollection1')->setHandle('test-custom-collection');
     // Create a new CustomCollection in the store
     $customCollection = $this->exporter->export($customCollection);
     $this->assertNotNull($customCollection->getId());
     // API Call limit
     usleep(50000);
     // Update CustomCollection
     $customCollection->setTitle('Updated CustomCollection1');
     $updated = $this->exporter->export($customCollection);
     $this->assertEquals('Updated CustomCollection1', $updated->getTitle());
     // API Call limit
     usleep(50000);
     // Delete the CustomCollection.
     $deleted = $this->exporter->remove($customCollection);
     $this->assertTrue($deleted);
 }