You are here

public function PhpExecutableFinderTest::testFindWithPhpPath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/process/Tests/PhpExecutableFinderTest.php \Symfony\Component\Process\Tests\PhpExecutableFinderTest::testFindWithPhpPath()

tests find() with the env var PHP_PATH.

File

vendor/symfony/process/Tests/PhpExecutableFinderTest.php, line 24

Class

PhpExecutableFinderTest
@author Robert Schönthal <seroscho@googlemail.com>

Namespace

Symfony\Component\Process\Tests

Code

public function testFindWithPhpPath() {
  if (defined('PHP_BINARY')) {
    $this
      ->markTestSkipped('The PHP binary is easily available as of PHP 5.4');
  }
  $f = new PhpExecutableFinder();
  $current = $f
    ->find();

  //not executable PHP_PATH
  putenv('PHP_PATH=/not/executable/php');
  $this
    ->assertFalse($f
    ->find(), '::find() returns false for not executable PHP');
  $this
    ->assertFalse($f
    ->find(false), '::find() returns false for not executable PHP');

  //executable PHP_PATH
  putenv('PHP_PATH=' . $current);
  $this
    ->assertEquals($f
    ->find(), $current, '::find() returns the executable PHP');
  $this
    ->assertEquals($f
    ->find(false), $current, '::find() returns the executable PHP');
}