Skip to content

Commit 12a86b0

Browse files
cluejmikola
authored andcommitted
Use getPhpBinary() helper
1 parent 28b5337 commit 12a86b0

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tests/AbstractProcessTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function testGetTermSignalWhenRunning($process)
6767

6868
public function testProcessWithDefaultCwdAndEnv()
6969
{
70-
$cmd = $this->cmd('echo getcwd(), PHP_EOL, count($_SERVER), PHP_EOL;');
70+
$cmd = $this->getPhpBinary() . ' -r ' . escapeshellarg('echo getcwd(), PHP_EOL, count($_SERVER), PHP_EOL;');
7171

7272
$loop = $this->createLoop();
7373
$process = new Process($cmd);
@@ -95,7 +95,7 @@ public function testProcessWithDefaultCwdAndEnv()
9595

9696
public function testProcessWithCwd()
9797
{
98-
$cmd = $this->cmd('echo getcwd(), PHP_EOL;');
98+
$cmd = $this->getPhpBinary() . ' -r ' . escapeshellarg('echo getcwd(), PHP_EOL;');
9999

100100
$loop = $this->createLoop();
101101
$process = new Process($cmd, '/');
@@ -120,7 +120,7 @@ public function testProcessWithEnv()
120120
$this->markTestSkipped('Cannot execute PHP processes with custom environments on Travis CI.');
121121
}
122122

123-
$cmd = $this->cmd('echo getenv("foo"), PHP_EOL;');
123+
$cmd = $this->getPhpBinary() . ' -r ' . escapeshellarg('echo getenv("foo"), PHP_EOL;');
124124

125125
$loop = $this->createLoop();
126126
$process = new Process($cmd, null, array('foo' => 'bar'));
@@ -327,8 +327,8 @@ public function assertSoon(\Closure $callback, $timeout = 20000, $interval = 200
327327
}
328328
}
329329

330-
private function cmd($code)
330+
private function getPhpBinary()
331331
{
332-
return (defined('PHP_BINARY') ? PHP_BINARY : 'php') . ' -r ' . escapeshellarg($code);
332+
return defined('PHP_BINARY') ? PHP_BINARY : 'php';
333333
}
334334
}

0 commit comments

Comments
 (0)