# upstream/trunk/vendor/symfony/process/Tests/PhpProcessTest.php

UpStream: a Project Management Plugin for WordPress, version trunk. 49 lines.

- Page: https://pluginprobe.com/plugins/upstream/trunk/code/vendor/symfony/process/Tests/PhpProcessTest.php
- Raw: https://pluginprobe.com/plugins/upstream/trunk/raw/vendor/symfony/process/Tests/PhpProcessTest.php
- Modified: 2024-05-22T12:40:54+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/upstream/trunk/code/vendor/symfony/process/Tests/PhpProcessTest.php#L10-L20`.

```php
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Process\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Process\PhpProcess;

class PhpProcessTest extends TestCase
{
    public function testNonBlockingWorks()
    {
        $expected = 'hello world!';
        $process = new PhpProcess(<<<PHP
<?php echo '$expected';
PHP
        );
        $process->start();
        $process->wait();
        $this->assertEquals($expected, $process->getOutput());
    }

    public function testCommandLine()
    {
        $process = new PhpProcess(<<<'PHP'
<?php echo phpversion().PHP_SAPI;
PHP
        );

        $commandLine = $process->getCommandLine();

        $process->start();
        $this->assertStringContainsString($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after start');

        $process->wait();
        $this->assertStringContainsString($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait');

        $this->assertSame(\PHP_VERSION.\PHP_SAPI, $process->getOutput());
    }
}

```
