コード例 #1
0
ファイル: RulesTest.php プロジェクト: Pyrex-FWI/sapar-mfo
 /**
  * @throws \Exception
  */
 public function testFileGenreRule()
 {
     $mediaInfoWrapper = Helper::getMedianfoWrapper();
     $id3meta = \Sapar\Mfo\Test\Helper::getId3Metadata(\Sapar\Mfo\Test\Helper::getSampeMp3File());
     $mediaInfoWrapper->read($id3meta);
     $mediaMove = new MediaMoveStack($id3meta);
     $moveResult = $mediaMove->reset()->pathAddMediaGenre()->pathAddMediaYear()->pathAddFileMonth()->moveIn(__DIR__ . '/..//');
     $this->assertEquals(true, $moveResult);
     $this->assertEquals(true, $moveResult);
     $this->assertContains('Celtic', $mediaMove->getTargetDest()->__toString());
     $this->assertContains('2003', $mediaMove->getTargetDest()->__toString());
     rename($mediaMove->getTargetDest(), Helper::getSampeMp3File());
     rmdir($mediaMove->getTargetDest()->getPath());
 }
コード例 #2
0
 /**
  *
  */
 public function testCommandLineExecute()
 {
     /** @var OrganizeCommand $command */
     $outputDir = __DIR__;
     $fildir = realpath(__DIR__ . '/../');
     $bin = realpath(__DIR__ . '/../../src/bin/organize');
     $cmd = "find {$fildir} -type f -name '*.mp3' -exec {$bin} organizer:files {$outputDir} {} \\;";
     $output = trim(shell_exec($cmd));
     $dest = new \SplFileInfo($output);
     $this->assertContains('Celtic', $dest->getRealPath());
     $this->assertTrue(true, is_file($output));
     $this->assertContains('2003', $dest->getRealPath());
     rename($dest->getRealPath(), Helper::getSampeMp3File());
     $fs = new Filesystem();
     $fs->remove(__DIR__ . '/2003/');
 }