/** * Save a FileItem into destiny paths * * @param FileItem $item */ public function saveItem(FileItem $item) { $fs = new Filesystem(); $paths = $item->getDestinationPaths(); if (0 == count($paths)) { throw new \LengthException('No destination paths found'); } foreach ($paths as $destination) { $fs->dumpFile($this->getDestinationDir() . '/' . $destination, $item->getDestinationContent()); } }
public function testSetDestinationContent() { $fileItem = new FileItem($this->mock, FileItem::TYPE_POST); $fileItem->setDestinationContent('<h1>trasformed content</h1>'); $this->assertEquals('<h1>trasformed content</h1>', $fileItem->getDestinationContent()); }