@@ -102,7 +102,7 @@ public function testAllOutputIsActuallyReadOnTermination()
102
102
$ expectedOutputSize = ProcessPipes::CHUNK_SIZE * 2 + 2 ;
103
103
104
104
$ code = sprintf ('echo str_repeat( \'* \', %d); ' , $ expectedOutputSize );
105
- $ p = $ this ->getProcess (sprintf ('php -r %s ' , escapeshellarg ($ code )));
105
+ $ p = $ this ->getProcess (sprintf ('%s -r %s ' , self :: $ phpBin , escapeshellarg ($ code )));
106
106
107
107
$ p ->start ();
108
108
// Let's wait enough time for process to finish...
@@ -141,7 +141,7 @@ public function testCallbacksAreExecutedWithStart()
141
141
*/
142
142
public function testProcessResponses ($ expected , $ getter , $ code )
143
143
{
144
- $ p = $ this ->getProcess (sprintf ('php -r %s ' , escapeshellarg ($ code )));
144
+ $ p = $ this ->getProcess (sprintf ('%s -r %s ' , self :: $ phpBin , escapeshellarg ($ code )));
145
145
$ p ->run ();
146
146
147
147
$ this ->assertSame ($ expected , $ p ->$ getter ());
@@ -157,7 +157,7 @@ public function testProcessPipes($code, $size)
157
157
$ expected = str_repeat (str_repeat ('* ' , 1024 ), $ size ).'! ' ;
158
158
$ expectedLength = (1024 * $ size ) + 1 ;
159
159
160
- $ p = $ this ->getProcess (sprintf ('php -r %s ' , escapeshellarg ($ code )));
160
+ $ p = $ this ->getProcess (sprintf ('%s -r %s ' , self :: $ phpBin , escapeshellarg ($ code )));
161
161
$ p ->setStdin ($ expected );
162
162
$ p ->run ();
163
163
@@ -246,7 +246,7 @@ public function testChainedCommandsOutput($expected, $operator, $input)
246
246
247
247
public function testCallbackIsExecutedForOutput ()
248
248
{
249
- $ p = $ this ->getProcess (sprintf ('php -r %s ' , escapeshellarg ('echo \'foo \'; ' )));
249
+ $ p = $ this ->getProcess (sprintf ('%s -r %s ' , self :: $ phpBin , escapeshellarg ('echo \'foo \'; ' )));
250
250
251
251
$ called = false ;
252
252
$ p ->run (function ($ type , $ buffer ) use (&$ called ) {
@@ -258,7 +258,7 @@ public function testCallbackIsExecutedForOutput()
258
258
259
259
public function testGetErrorOutput ()
260
260
{
261
- $ p = $ this ->getProcess (sprintf ('php -r %s ' , escapeshellarg ('$n = 0; while ($n < 3) { file_put_contents( \'php://stderr \', \'ERROR \'); $n++; } ' )));
261
+ $ p = $ this ->getProcess (sprintf ('%s -r %s ' , self :: $ phpBin , escapeshellarg ('$n = 0; while ($n < 3) { file_put_contents( \'php://stderr \', \'ERROR \'); $n++; } ' )));
262
262
263
263
$ p ->run ();
264
264
$ this ->assertEquals (3 , preg_match_all ('/ERROR/ ' , $ p ->getErrorOutput (), $ matches ));
@@ -271,7 +271,7 @@ public function testGetIncrementalErrorOutput()
271
271
$ lock = tempnam (sys_get_temp_dir (), get_class ($ this ).'Lock ' );
272
272
file_put_contents ($ lock , 'W ' );
273
273
274
- $ p = $ this ->getProcess (sprintf ('php -r %s ' , escapeshellarg ('$n = 0; while ($n < 3) { if ( \'W \' === file_get_contents( ' .var_export ($ lock , true ).')) { file_put_contents( \'php://stderr \', \'ERROR \'); $n++; file_put_contents( ' .var_export ($ lock , true ).', \'R \'); } usleep(100); } ' )));
274
+ $ p = $ this ->getProcess (sprintf ('%s -r %s ' , self :: $ phpBin , escapeshellarg ('$n = 0; while ($n < 3) { if ( \'W \' === file_get_contents( ' .var_export ($ lock , true ).')) { file_put_contents( \'php://stderr \', \'ERROR \'); $n++; file_put_contents( ' .var_export ($ lock , true ).', \'R \'); } usleep(100); } ' )));
275
275
276
276
$ p ->start ();
277
277
while ($ p ->isRunning ()) {
@@ -292,7 +292,7 @@ public function testGetEmptyIncrementalErrorOutput()
292
292
$ lock = tempnam (sys_get_temp_dir (), get_class ($ this ).'Lock ' );
293
293
file_put_contents ($ lock , 'W ' );
294
294
295
- $ p = $ this ->getProcess (sprintf ('php -r %s ' , escapeshellarg ('$n = 0; while ($n < 3) { if ( \'W \' === file_get_contents( ' .var_export ($ lock , true ).')) { file_put_contents( \'php://stderr \', \'ERROR \'); $n++; file_put_contents( ' .var_export ($ lock , true ).', \'R \'); } usleep(100); } ' )));
295
+ $ p = $ this ->getProcess (sprintf ('%s -r %s ' , self :: $ phpBin , escapeshellarg ('$n = 0; while ($n < 3) { if ( \'W \' === file_get_contents( ' .var_export ($ lock , true ).')) { file_put_contents( \'php://stderr \', \'ERROR \'); $n++; file_put_contents( ' .var_export ($ lock , true ).', \'R \'); } usleep(100); } ' )));
296
296
297
297
$ p ->start ();
298
298
@@ -318,7 +318,7 @@ public function testGetEmptyIncrementalErrorOutput()
318
318
319
319
public function testGetOutput ()
320
320
{
321
- $ p = $ this ->getProcess (sprintf ('php -r %s ' , escapeshellarg ('$n = 0; while ($n < 3) { echo \' foo \'; $n++; } ' )));
321
+ $ p = $ this ->getProcess (sprintf ('%s -r %s ' , self :: $ phpBin , escapeshellarg ('$n = 0; while ($n < 3) { echo \' foo \'; $n++; } ' )));
322
322
323
323
$ p ->run ();
324
324
$ this ->assertEquals (3 , preg_match_all ('/foo/ ' , $ p ->getOutput (), $ matches ));
@@ -331,7 +331,7 @@ public function testGetIncrementalOutput()
331
331
$ lock = tempnam (sys_get_temp_dir (), get_class ($ this ).'Lock ' );
332
332
file_put_contents ($ lock , 'W ' );
333
333
334
- $ p = $ this ->getProcess (sprintf ('php -r %s ' , escapeshellarg ('$n = 0; while ($n < 3) { if ( \'W \' === file_get_contents( ' .var_export ($ lock , true ).')) { echo \' foo \'; $n++; file_put_contents( ' .var_export ($ lock , true ).', \'R \'); } usleep(100); } ' )));
334
+ $ p = $ this ->getProcess (sprintf ('%s -r %s ' , self :: $ phpBin , escapeshellarg ('$n = 0; while ($n < 3) { if ( \'W \' === file_get_contents( ' .var_export ($ lock , true ).')) { echo \' foo \'; $n++; file_put_contents( ' .var_export ($ lock , true ).', \'R \'); } usleep(100); } ' )));
335
335
336
336
$ p ->start ();
337
337
while ($ p ->isRunning ()) {
@@ -352,7 +352,7 @@ public function testGetEmptyIncrementalOutput()
352
352
$ lock = tempnam (sys_get_temp_dir (), get_class ($ this ).'Lock ' );
353
353
file_put_contents ($ lock , 'W ' );
354
354
355
- $ p = $ this ->getProcess (sprintf ('php -r %s ' , escapeshellarg ('$n = 0; while ($n < 3) { if ( \'W \' === file_get_contents( ' .var_export ($ lock , true ).')) { echo \' foo \'; $n++; file_put_contents( ' .var_export ($ lock , true ).', \'R \'); } usleep(100); } ' )));
355
+ $ p = $ this ->getProcess (sprintf ('%s -r %s ' , self :: $ phpBin , escapeshellarg ('$n = 0; while ($n < 3) { if ( \'W \' === file_get_contents( ' .var_export ($ lock , true ).')) { echo \' foo \'; $n++; file_put_contents( ' .var_export ($ lock , true ).', \'R \'); } usleep(100); } ' )));
356
356
357
357
$ p ->start ();
358
358
@@ -733,7 +733,7 @@ public function testCheckTimeoutOnStartedProcess()
733
733
734
734
public function testStartAfterATimeout ()
735
735
{
736
- $ process = $ this ->getProcess (sprintf ('php -r %s ' , escapeshellarg ('$n = 1000; while ($n--) {echo \'\'; usleep(1000); } ' )));
736
+ $ process = $ this ->getProcess (sprintf ('%s -r %s ' , self :: $ phpBin , escapeshellarg ('$n = 1000; while ($n--) {echo \'\'; usleep(1000); } ' )));
737
737
$ process ->setTimeout (0.1 );
738
738
try {
739
739
$ process ->run ();
0 commit comments