Пример #1
0
 /**
  * commit tests
  */
 public function testCommit()
 {
     $showCommand = new ShowCommand();
     $this->commit = Commit::pick($this->getRepository());
     $this->assertInstanceOf('\\GitElephant\\Objects\\Commit', $this->commit);
     $this->assertInstanceOf('\\GitElephant\\Objects\\Author', $this->commit->getAuthor());
     $this->assertInstanceOf('\\GitElephant\\Objects\\Author', $this->commit->getCommitter());
     $this->assertInstanceOf('\\Datetime', $this->commit->getDatetimeAuthor());
     $this->assertInstanceOf('\\Datetime', $this->commit->getDatetimeCommitter());
     $this->assertInstanceOf('\\GitElephant\\Objects\\Commit\\Message', $this->commit->getMessage());
     $this->assertEquals('first commit', $this->commit->getMessage()->toString());
     $this->assertRegExp('/^\\w{40}$/', $this->commit->getSha());
     $this->assertEquals(array(), $this->commit->getParents());
     $this->addFile('foo2');
     $mainCommand = new MainCommand();
     $this->getCaller()->execute($mainCommand->add());
     $this->getCaller()->execute($mainCommand->commit('second commit'));
     $this->getCaller()->execute($showCommand->showCommit('HEAD'));
     $this->commit = Commit::pick($this->getRepository());
     $parents = $this->commit->getParents();
     $this->assertRegExp('/^\\w{40}$/', $parents[0]);
 }
Пример #2
0
 /**
  * get the commit properties from command
  *
  * @see ShowCommand::commitInfo
  */
 public function createFromCommand()
 {
     $command = ShowCommand::getInstance($this->getRepository())->showCommit($this->ref);
     $outputLines = $this->getCaller()->execute($command, true, $this->getRepository()->getPath())->getOutputLines();
     $this->parseOutputLines($outputLines);
 }