/** * @param LifecycleEventArgs $eventArgs */ public function preRemove(LifecycleEventArgs $eventArgs) { $entity = $eventArgs->getEntity(); if (!$entity instanceof Media) { return; } $this->mediaManager->removeMedia($entity); }
/** * @covers Kunstmaan\MediaBundle\Helper\MediaManager::removeMedia */ public function testRemoveMediaWithCustomHandler() { $media = new Media(); $handler = $this->getCustomHandler($media); $handler->expects($this->once())->method('removeMedia')->with($this->equalTo($media)); $this->object->addHandler($handler); $this->object->removeMedia($media); }