1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Fix for Preforce utility does not check if p4 command exists

This commit is contained in:
Fabian Grutschus 2013-10-14 14:53:57 +02:00
parent cd209e3180
commit 5ae5963acd
2 changed files with 23 additions and 2 deletions

View file

@ -631,6 +631,27 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$result = $this->perforce->checkServerExists('perforce.does.not.exist:port', $processExecutor);
$this->assertTrue($result);
}
/**
* Test if "p4" command is missing.
*
* @covers \Composer\Util\Perforce::checkServerExists
*
* @return void
*/
public function testCheckServerExistsWithMissingPerforceClient()
{
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
$expectedCommand = 'p4 -p perforce.does.exist:port info -s';
$processExecutor->expects($this->at(0))
->method('execute')
//->with($this->equalTo($expectedCommand), $this->equalTo(null))
->will($this->returnValue(127));
$result = $this->perforce->checkServerExists('perforce.does.exist:port', $processExecutor);
$this->assertFalse($result);
}
public static function getComposerJson()
{