コード例 #1
0
ファイル: MvCommandTest.php プロジェクト: ocubom/GitElephant
 /**
  * testRename
  */
 public function testRename()
 {
     $mc = MvCommand::getInstance();
     $this->assertEquals("mv '-k' 'a' 'b'", $mc->rename('a', 'b'));
     $tree = $this->repository->getTree('HEAD', 'test');
     $this->assertEquals("mv '-k' 'test' 'b'", $mc->rename($tree->getBlob(), 'b'));
     $tree = $this->repository->getTree('HEAD', 'test_folder/test2');
     $this->assertEquals("mv '-k' 'test_folder/test2' 'b'", $mc->rename($tree->getBlob(), 'b'));
 }
コード例 #2
0
ファイル: TestCase.php プロジェクト: ocubom/GitElephant
 /**
  * rename a file in the repository
  *
  * @param string $originName file name
  * @param string $targetName new file name
  * @param bool   $gitMv      use git mv, otherwise uses php rename function (with the Filesystem component)
  */
 protected function renameFile($originName, $targetName, $gitMv = true)
 {
     if ($gitMv) {
         $this->getRepository()->getCaller()->execute(MvCommand::getInstance()->rename($originName, $targetName));
         return;
     }
     $origin = $this->path . DIRECTORY_SEPARATOR . $originName;
     $target = $this->path . DIRECTORY_SEPARATOR . $targetName;
     $fs = new Filesystem();
     $fs->rename($origin, $target);
 }