示例#1
0
 public function doTestDeleteFile($model, $modelParent, $type, $obj)
 {
     $targetFile = THELIA_LOCAL_DIR . 'media' . DS . $type . DS . $obj . DS . "original-" . $model->getId() . ".txt";
     $model->setParentId($modelParent->getId())->setFile(basename($targetFile))->save();
     @unlink($targetFile);
     copy(__DIR__ . DS . 'fixtures' . DS . 'test.txt', $targetFile);
     $this->assertFileExists($targetFile);
     $this->fileManager->deleteFile($model);
     $this->assertFileNotExists($targetFile);
 }
示例#2
0
 /**
  * Deleting file in the database and in storage
  *
  * @param FileDeleteEvent $event Image event
  */
 public function deleteFile(FileDeleteEvent $event)
 {
     $this->fileManager->deleteFile($event->getFileToDelete());
 }