/** * @expectedException RuntimeException * @expectedExceptionCode 300 */ public function testGitExecuteCommandWhenGitReturnsError() { $exec = $this->getMock('SagePHP\\System\\Exec', array('run', 'hasErrors')); $exec->expects($this->once())->method('run')->will($this->returnValue(300)); $exec->expects($this->any())->method('hasErrors')->will($this->returnValue(true)); $exec->setProcessExecutor($this->getMock('Symfony\\Component\\Process\\Process', array(), array(''))); $git = new Git($exec); $git->cloneRepository('git@github.com:francodacosta/phmagick.git', $folder = 'foo', $branch = 'dev'); }
<?php include __DIR__ . '/../unit/bootstrap.php'; use SagePHP\System\Exec; use SagePHP\VCS\Git; $exec = new Exec(); $git = new Git($exec); $git->cloneRepository('git@github.com:francodacosta/phmagick.git');