/** * @param Product $product * * @return bool */ public function remove(Product $product) { if (null == $product->getId()) { throw new \ErrorException('Can not remove a non existent Product !'); } else { $request = new DeleteJson($this->removeUrl($product)); } $deleted = $request->makeRequest(); return $deleted; }
public function testCreateAndRemoveANewProduct() { $product = new Product(); $product->setTags('tag1, tag2, tag3')->setTitle('Test Product1')->setBodyHtml('Body Test Product1')->setProductType('Test')->setVendor('symfony'); // Create a new Product in the store $product = $this->exporter->export($product); $this->assertNotNull($product->getId()); // API Call limit usleep(50000); // Update Product $product->setTitle('Updated Product1'); $updated = $this->exporter->export($product); $this->assertEquals('Updated Product1', $updated->getTitle()); // API Call limit usleep(50000); // Delete the Product. $deleted = $this->exporter->remove($product); $this->assertTrue($deleted); }