Removed unnecessary test and just check for return code
parent
0c5bd559f2
commit
20854a50b4
|
@ -367,10 +367,7 @@ class Perforce
|
||||||
|
|
||||||
public static function checkServerExists($url, ProcessExecutor $processExecutor)
|
public static function checkServerExists($url, ProcessExecutor $processExecutor)
|
||||||
{
|
{
|
||||||
$result = '';
|
return 0 === $processExecutor->execute('p4 -p ' . $url . ' info -s');
|
||||||
$exitCode = $processExecutor->execute('p4 -p ' . $url . ' info -s', $result);
|
|
||||||
|
|
||||||
return false === strpos($result, 'error') && 0 === $exitCode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getComposerInformation($identifier)
|
public function getComposerInformation($identifier)
|
||||||
|
|
|
@ -618,20 +618,6 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCheckServerExistsWithFailure()
|
|
||||||
{
|
|
||||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
|
||||||
|
|
||||||
$expectedCommand = 'p4 -p perforce.does.not.exist:port info -s';
|
|
||||||
$processExecutor->expects($this->at(0))
|
|
||||||
->method('execute')
|
|
||||||
->with($this->equalTo($expectedCommand), $this->equalTo(null))
|
|
||||||
->will($this->returnValue('Perforce client error:'));
|
|
||||||
|
|
||||||
$result = $this->perforce->checkServerExists('perforce.does.not.exist:port', $processExecutor);
|
|
||||||
$this->assertTrue($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if "p4" command is missing.
|
* Test if "p4" command is missing.
|
||||||
*
|
*
|
||||||
|
@ -639,13 +625,14 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testCheckServerExistsWithMissingPerforceClient()
|
public function testCheckServerClientError()
|
||||||
{
|
{
|
||||||
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
|
||||||
|
|
||||||
$expectedCommand = 'p4 -p perforce.does.exist:port info -s';
|
$expectedCommand = 'p4 -p perforce.does.exist:port info -s';
|
||||||
$processExecutor->expects($this->at(0))
|
$processExecutor->expects($this->at(0))
|
||||||
->method('execute')
|
->method('execute')
|
||||||
|
->with($this->equalTo($expectedCommand), $this->equalTo(null))
|
||||||
->will($this->returnValue(127));
|
->will($this->returnValue(127));
|
||||||
|
|
||||||
$result = $this->perforce->checkServerExists('perforce.does.exist:port', $processExecutor);
|
$result = $this->perforce->checkServerExists('perforce.does.exist:port', $processExecutor);
|
||||||
|
|
Loading…
Reference in New Issue