|
|
|
@ -50,6 +50,35 @@ class FileSystemTaskTest extends TestCase
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testCopyTaskWithFlags() |
|
|
|
|
{ |
|
|
|
|
$runtime = new RuntimeMockup(); |
|
|
|
|
$runtime->setConfiguration(['environments' => ['test' => []]]); |
|
|
|
|
$runtime->setEnvironment('test'); |
|
|
|
|
|
|
|
|
|
$task = new CopyTask(); |
|
|
|
|
$task->setOptions(['from' => 'a.txt', 'to' => 'b.txt', 'flags' => '-rp']); |
|
|
|
|
$task->setRuntime($runtime); |
|
|
|
|
|
|
|
|
|
$this->assertContains('a.txt', $task->getDescription()); |
|
|
|
|
$this->assertContains('b.txt', $task->getDescription()); |
|
|
|
|
$task->execute(); |
|
|
|
|
|
|
|
|
|
$ranCommands = $runtime->getRanCommands(); |
|
|
|
|
|
|
|
|
|
$testCase = array( |
|
|
|
|
0 => 'cp -rp "a.txt" "b.txt"', |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// 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 testCopyReplaceTask() |
|
|
|
|
{ |
|
|
|
|
$runtime = new RuntimeMockup(); |
|
|
|
@ -159,6 +188,35 @@ class FileSystemTaskTest extends TestCase
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testMoveWithFlagsTask() |
|
|
|
|
{ |
|
|
|
|
$runtime = new RuntimeMockup(); |
|
|
|
|
$runtime->setConfiguration(['environments' => ['test' => []]]); |
|
|
|
|
$runtime->setEnvironment('test'); |
|
|
|
|
|
|
|
|
|
$task = new MoveTask(); |
|
|
|
|
$task->setOptions(['from' => 'a.txt', 'to' => 'b.txt', 'flags' => '-n']); |
|
|
|
|
$task->setRuntime($runtime); |
|
|
|
|
|
|
|
|
|
$this->assertContains('a.txt', $task->getDescription()); |
|
|
|
|
$this->assertContains('b.txt', $task->getDescription()); |
|
|
|
|
$task->execute(); |
|
|
|
|
|
|
|
|
|
$ranCommands = $runtime->getRanCommands(); |
|
|
|
|
|
|
|
|
|
$testCase = array( |
|
|
|
|
0 => 'mv -n "a.txt" "b.txt"', |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// 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 testMoveReplaceTask() |
|
|
|
|
{ |
|
|
|
|
$runtime = new RuntimeMockup(); |
|
|
|
@ -341,6 +399,35 @@ class FileSystemTaskTest extends TestCase
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testLinkTaskWithFlags() |
|
|
|
|
{ |
|
|
|
|
$runtime = new RuntimeMockup(); |
|
|
|
|
$runtime->setConfiguration(['environments' => ['test' => []]]); |
|
|
|
|
$runtime->setEnvironment('test'); |
|
|
|
|
|
|
|
|
|
$task = new LinkTask(); |
|
|
|
|
$task->setOptions(['from' => 'a.txt', 'to' => 'b.txt', 'flags' => '-P']); |
|
|
|
|
$task->setRuntime($runtime); |
|
|
|
|
|
|
|
|
|
$this->assertContains('a.txt', $task->getDescription()); |
|
|
|
|
$this->assertContains('b.txt', $task->getDescription()); |
|
|
|
|
$task->execute(); |
|
|
|
|
|
|
|
|
|
$ranCommands = $runtime->getRanCommands(); |
|
|
|
|
|
|
|
|
|
$testCase = array( |
|
|
|
|
0 => 'ln -P "a.txt" "b.txt"', |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// 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 testLinkReplaceTask() |
|
|
|
|
{ |
|
|
|
|
$runtime = new RuntimeMockup(); |
|
|
|
|