/** * Clones a remote repository to the specified file path. * * @param string $url URL to remote repository to clone * @param string $path File path to clone the repository to * * @return Repository * * @throws Exception\RuntimeException */ public function invokeClone($url, $path) { $result = $this->process->setCommand("{$this->path} clone \"{$url}\" \"{$path}\"")->execute(); if ($result->hasErrors()) { throw new RuntimeException("Failed to clone {$url}: {$result->getStdErrContents()}"); } return $this->invokeOpen($path); }
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()); }