|
|
@ -104,40 +104,6 @@ class SelfUpdateTaskTest extends TestCase |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testSelfUpdateMustUpdateToVersionTask() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$runtime = new RuntimeMockup(); |
|
|
|
|
|
|
|
$runtime->setConfiguration(['environments' => ['test' => []]]); |
|
|
|
|
|
|
|
$runtime->setEnvironment('test'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$task = new SelfUpdateTask(); |
|
|
|
|
|
|
|
$task->setOptions(['path' => 'composer.phar', 'version' => '1.2.0']); |
|
|
|
|
|
|
|
$task->setRuntime($runtime); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
$result = $task->execute(); |
|
|
|
|
|
|
|
$this->assertTrue($result, 'Result should be successful'); |
|
|
|
|
|
|
|
} catch (Exception $exception) { |
|
|
|
|
|
|
|
if ($exception instanceof SkipException) { |
|
|
|
|
|
|
|
$this->assertTrue(false, 'Update should not have been skipped'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$ranCommands = $runtime->getRanCommands(); |
|
|
|
|
|
|
|
$testCase = array( |
|
|
|
|
|
|
|
0 => 'composer.phar --version', |
|
|
|
|
|
|
|
1 => 'composer.phar self-update 1.2.0', |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check total of Executed Commands |
|
|
|
|
|
|
|
$this->assertEquals(count($testCase), count($ranCommands)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check Generated Commands |
|
|
|
|
|
|
|
foreach ($testCase as $index => $command) { |
|
|
|
|
|
|
|
$this->assertEquals($command, $ranCommands[$index]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function testSelfUpdateWrongOutputTask() |
|
|
|
public function testSelfUpdateWrongOutputTask() |
|
|
|
{ |
|
|
|
{ |
|
|
|
$runtime = new RuntimeMockup(); |
|
|
|
$runtime = new RuntimeMockup(); |
|
|
|