Skip to content

Commit 78e2847

Browse files
committed
Merge pull request #94 from FriendsOfSymfony/process-builder
Use ProcessBuilder
2 parents fa42b7c + 8f04d2a commit 78e2847

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

tests/VarnishTestCase.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use FOS\HttpCache\ProxyClient\Varnish;
1515
use Symfony\Component\Process\Process;
16+
use Symfony\Component\Process\ProcessBuilder;
1617

1718
/**
1819
* A phpunit base class to write functional tests with varnish.
@@ -156,15 +157,17 @@ protected function stopVarnish()
156157
*/
157158
protected function startVarnish()
158159
{
159-
$cmd = $this->getBinary() .
160-
' -a 127.0.0.1:' . $this->getCachingProxyPort() .
161-
' -T 127.0.0.1:' . $this->getVarnishMgmtPort() .
162-
' -f ' . $this->getConfigFile() .
163-
' -n ' . $this->getCacheDir() .
164-
' -p vcl_dir=' . $this->getConfigDir() .
165-
' -P ' . self::PID;
166-
167-
$process = new Process($cmd);
160+
$builder = new ProcessBuilder(array(
161+
$this->getBinary(),
162+
'-a', '127.0.0.1:' . $this->getCachingProxyPort(),
163+
'-T', '127.0.0.1:' . $this->getVarnishMgmtPort(),
164+
'-f', $this->getConfigFile(),
165+
'-n', $this->getCacheDir(),
166+
'-p', 'vcl_dir=' . $this->getConfigDir(),
167+
'-P', self::PID
168+
));
169+
170+
$process = $builder->getProcess();
168171
$process->run();
169172

170173
if (!$process->isSuccessful()) {

0 commit comments

Comments
 (0)