コード例 #1
0
ファイル: ProcessTest.php プロジェクト: lshepstone/php-proc
 public function testExecuteWithErrorsReturnsExpectedResult()
 {
     $process = new Process();
     $process->setCommand("php -r \"trigger_error('error', E_USER_ERROR);\"");
     $result = $process->execute();
     $this->assertSame(255, $result->getStatus());
     $this->assertTrue($result->hasErrors());
     $this->assertContains("PHP Fatal error", $result->getStdErrContents());
 }
コード例 #2
0
ファイル: Git.php プロジェクト: lshepstone/php-git
 /**
  * Pulls changes from the default remote of an existing local repository.
  *
  * @param string $path Path to the local repository
  *
  * @return Repository
  *
  * @throws Exception\RuntimeException
  * @throws Exception\RepositoryNotFoundException
  */
 public function invokePull($path)
 {
     if (false === $this->repoExists($path)) {
         throw new RepoNotFoundException("No Git repository was found at '{$path}'");
     }
     $result = $this->process->setWorkingDirectory($path)->setCommand("{$this->path} pull")->execute();
     if ($result->hasErrors()) {
         throw new RuntimeException("Failed to pull at {$path}: {$result->getStdErrContents()}");
     }
 }