コード例 #1
0
ファイル: FileItemTest.php プロジェクト: pancao/Spress
 public function testSetDestinationPaths()
 {
     $fileItem = new FileItem($this->mock, FileItem::TYPE_POST);
     $fileItem->setDestinationPaths(array('/spress_test/_site/2013/08/22/example.html'));
     $this->assertTrue(is_array($fileItem->getDestinationPaths()));
     $this->assertCount(1, $fileItem->getDestinationPaths());
 }
コード例 #2
0
ファイル: ContentLocator.php プロジェクト: pancao/Spress
 /**
  * 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());
     }
 }