4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Process\Tests;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Process\PhpExecutableFinder;
16 use Symfony\Component\Process\PhpProcess;
18 class PhpProcessTest extends TestCase
20 public function testNonBlockingWorks()
22 $expected = 'hello world!';
23 $process = new PhpProcess(<<<PHP
24 <?php echo '$expected';
29 $this->assertEquals($expected, $process->getOutput());
32 public function testCommandLine()
34 $process = new PhpProcess(<<<'PHP'
39 $commandLine = $process->getCommandLine();
41 $f = new PhpExecutableFinder();
42 $this->assertContains($f->find(), $commandLine, '::getCommandLine() returns the command line of PHP before start');
45 $this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after start');
48 $this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait');