Skip to content

Commit

Permalink
fix #2 check commandline arguments test
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Oct 25, 2016
1 parent 6ad0900 commit 87ea383
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ public function testCreateWhenOnlyRunnerScriptPathSets() {
$this->assertSame('id', $workerProcess->getId());
$process = $workerProcess->getProcess();
$this->assertInstanceOf(Process::class, $process);
$expectedCommandLine = ProcessUtils::escapeArgument('php');
$expectedCommandLine .= ' '.ProcessUtils::escapeArgument('runner.php');
$expectedCommandLine .= ' '.ProcessUtils::escapeArgument('id');

$expectedCommandLine = $this->getCommandLine(['php', 'runner.php', 'id']);
$this->assertEquals($expectedCommandLine, $process->getCommandLine());
}

Expand All @@ -46,6 +43,11 @@ public function testCreateWithArguments() {

$workerProcess = $factory->create('id');
$process = $workerProcess->getProcess();
$this->assertEquals('"php" "runner.php" "id" "arg1" "arg2"', $process->getCommandLine());
$expectedCommandLine = $this->getCommandLine(['php', 'runner.php', 'id', 'arg1', 'arg2']);
$this->assertEquals($expectedCommandLine, $process->getCommandLine());
}

private function getCommandLine(array $arguments) {
return implode(' ', array_map(array(ProcessUtils::class, 'escapeArgument'), $arguments));
}
}

0 comments on commit 87ea383

Please sign in to comment.