ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PhpProcessTest.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
13
16
18{
19 public function testNonBlockingWorks()
20 {
21 $expected = 'hello world!';
22 $process = new PhpProcess(<<<PHP
23<?php echo '$expected';
24PHP
25 );
26 $process->start();
27 $process->wait();
28 $this->assertEquals($expected, $process->getOutput());
29 }
30
31 public function testCommandLine()
32 {
33 $process = new PhpProcess(<<<'PHP'
34<?php echo 'foobar';
35PHP
36 );
37
38 $commandLine = $process->getCommandLine();
39
40 $f = new PhpExecutableFinder();
41 $this->assertContains($f->find(), $commandLine, '::getCommandLine() returns the command line of PHP before start');
42
43 $process->start();
44 $this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after start');
45
46 $process->wait();
47 $this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait');
48 }
49}
An exception for terminatinating execution or to throw for unit testing.
An executable finder specifically designed for the PHP executable.
PhpProcess runs a PHP script in an independent process.
Definition: PhpProcess.php:26
start(callable $callback=null)
{Starts the process and returns after writing the input to STDIN.This method blocks until all STDIN d...
Definition: PhpProcess.php:70
getCommandLine()
Gets the command line to be executed.
Definition: Process.php:885