/** * @param ProductModel $product * @depends testAddContent */ public function testRemoveContent(ProductModel $product) { $product->clearProductAssociatedContents(); $contents = $product->getProductAssociatedContents(); $this->assertEquals(1, count($contents)); $content = $contents->getFirst(); $event = new ProductDeleteContentEvent($product, $content->getContentId()); $event->setDispatcher($this->getDispatcher()); $action = new Product(); $action->removeContent($event); $product->clearProductAssociatedContents(); $deletedContent = $product->getProductAssociatedContents(); $this->assertEquals(0, count($deletedContent)); return $product; }