PluginProbe
UpStream: a Project Management Plugin for WordPress / trunk
UpStream: a Project Management Plugin for WordPress vtrunk
trunk 1.39.0 1.39.1 1.39.2 1.39.3 2.0.7 2.1.0
upstream / vendor / symfony / process / Tests / PhpExecutableFinderTest.php

PhpExecutableFinderTest.php in UpStream: a Project Management Plugin for WordPress trunk, at vendor/symfony/process/Tests/PhpExecutableFinderTest.php

73 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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
12 namespace Symfony\Component\Process\Tests;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Process\PhpExecutableFinder;
16
17 /**
18 * @author Robert Schönthal <seroscho@googlemail.com>
19 */
20 class PhpExecutableFinderTest extends TestCase
21 {
22 /**
23 * tests find() with the constant PHP_BINARY.
24 */
25 public function testFind()
26 {
27 if (\defined('HHVM_VERSION')) {
28 $this->markTestSkipped('Should not be executed in HHVM context.');
29 }
30
31 $f = new PhpExecutableFinder();
32
33 $current = \PHP_BINARY;
34 $args = 'phpdbg' === \PHP_SAPI ? ' -qrr' : '';
35
36 $this->assertEquals($current.$args, $f->find(), '::find() returns the executable PHP');
37 $this->assertEquals($current, $f->find(false), '::find() returns the executable PHP');
38 }
39
40 /**
41 * tests find() with the env var / constant PHP_BINARY with HHVM.
42 */
43 public function testFindWithHHVM()
44 {
45 if (!\defined('HHVM_VERSION')) {
46 $this->markTestSkipped('Should be executed in HHVM context.');
47 }
48
49 $f = new PhpExecutableFinder();
50
51 $current = getenv('PHP_BINARY') ?: \PHP_BINARY;
52
53 $this->assertEquals($current.' --php', $f->find(), '::find() returns the executable PHP');
54 $this->assertEquals($current, $f->find(false), '::find() returns the executable PHP');
55 }
56
57 /**
58 * tests find() with the env var PHP_PATH.
59 */
60 public function testFindArguments()
61 {
62 $f = new PhpExecutableFinder();
63
64 if (\defined('HHVM_VERSION')) {
65 $this->assertEquals(['--php'], $f->findArguments(), '::findArguments() returns HHVM arguments');
66 } elseif ('phpdbg' === \PHP_SAPI) {
67 $this->assertEquals(['-qrr'], $f->findArguments(), '::findArguments() returns phpdbg arguments');
68 } else {
69 $this->assertEquals([], $f->findArguments(), '::findArguments() returns no arguments');
70 }
71 }
72 }
73