예제 #1
0
 /**
  * @test
  */
 public function rootCommand()
 {
     /* @var $rootCmd \Siad007\VersionControl\HG\Command\RootCommand */
     $rootCmd = Factory::getInstance('root');
     $expected = 'hg root';
     $this->assertSame($expected, $rootCmd->asString());
 }
 /**
  * @test
  */
 public function pathsCommand()
 {
     /* @var $pathsCmd \Siad007\VersionControl\HG\Command\PathsCommand */
     $pathsCmd = Factory::getInstance('paths');
     $pathsCmd->setName('test');
     $expected = 'hg paths test';
     $this->assertSame('test', $pathsCmd->getName());
     $this->assertSame($expected, $pathsCmd->asString());
 }
 /**
  * @test
  */
 public function cloneCommandWithoutSource()
 {
     /* @var $cloneCmd \Siad007\VersionControl\HG\Command\CloneCommand */
     $cloneCmd = Factory::getInstance('clone');
     $cloneCmd->setUncompressed(true);
     $cloneCmd->setInsecure(true);
     $cloneCmd->asString();
     $this->assertError("No source directory given.", E_USER_ERROR);
 }
예제 #4
0
 /**
  * @test
  */
 public function pushCommand()
 {
     /* @var $pushCmd \Siad007\VersionControl\HG\Command\PushCommand */
     $pushCmd = Factory::getInstance('push');
     $pushCmd->setDestination('C:\\xampp\\dest\\');
     $pushCmd->setSsh('testSSH');
     $pushCmd->setInsecure(true);
     $pushCmd->setVerbose(true);
     $pushCmd->setEncoding('UTF-8');
     $destination = '\'C:\\xampp\\dest\\\'';
     $expected = 'hg push --verbose --encoding ' . escapeshellarg('UTF-8') . ' --ssh ' . escapeshellarg('testSSH') . ' --insecure ';
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         $destination = str_replace("'", '"', $destination);
     }
     $this->assertSame($destination, $pushCmd->getDestination());
     $this->assertSame($expected . $destination, $pushCmd->asString());
 }
예제 #5
0
 /**
  * @test
  */
 public function pullCommand()
 {
     /* @var $pullCmd \Siad007\VersionControl\HG\Command\PullCommand */
     $pullCmd = Factory::getInstance('pull');
     $pullCmd->setSource('C:\\xampp\\source\\');
     $pullCmd->addRev('rev1');
     $pullCmd->addRev('rev2');
     $pullCmd->addBookmark('bookmark');
     $pullCmd->addBranch('branch');
     $pullCmd->setSsh('testSSH');
     $pullCmd->setInsecure(true);
     $pullCmd->setVerbose(true);
     $pullCmd->setEncoding('UTF-8');
     $source = '\'C:\\xampp\\source\\\'';
     $expected = 'hg pull --verbose --encoding ' . escapeshellarg('UTF-8') . ' --rev rev1 rev2 --bookmark bookmark --branch branch --ssh ' . escapeshellarg('testSSH') . ' --insecure ';
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         $source = str_replace("'", '"', $source);
     }
     $this->assertSame($source, $pullCmd->getSource());
     $this->assertSame($expected . $source, $pullCmd->asString());
 }
예제 #6
0
 /**
  * @test
  * @expectedException \InvalidArgumentException
  */
 public function notExistingCommand()
 {
     Factory::getInstance('test');
 }