ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PhpExecutableFinderTest.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
15
20{
24 public function testFind()
25 {
26 if (defined('HHVM_VERSION')) {
27 $this->markTestSkipped('Should not be executed in HHVM context.');
28 }
29
30 $f = new PhpExecutableFinder();
31
32 $current = PHP_BINARY;
33 $args = 'phpdbg' === PHP_SAPI ? ' -qrr' : '';
34
35 $this->assertEquals($current.$args, $f->find(), '::find() returns the executable PHP');
36 $this->assertEquals($current, $f->find(false), '::find() returns the executable PHP');
37 }
38
42 public function testFindWithHHVM()
43 {
44 if (!defined('HHVM_VERSION')) {
45 $this->markTestSkipped('Should be executed in HHVM context.');
46 }
47
48 $f = new PhpExecutableFinder();
49
50 $current = getenv('PHP_BINARY') ?: PHP_BINARY;
51
52 $this->assertEquals($current.' --php', $f->find(), '::find() returns the executable PHP');
53 $this->assertEquals($current, $f->find(false), '::find() returns the executable PHP');
54 }
55
59 public function testFindArguments()
60 {
61 $f = new PhpExecutableFinder();
62
63 if (defined('HHVM_VERSION')) {
64 $this->assertEquals($f->findArguments(), array('--php'), '::findArguments() returns HHVM arguments');
65 } elseif ('phpdbg' === PHP_SAPI) {
66 $this->assertEquals($f->findArguments(), array('-qrr'), '::findArguments() returns phpdbg arguments');
67 } else {
68 $this->assertEquals($f->findArguments(), array(), '::findArguments() returns no arguments');
69 }
70 }
71}
An exception for terminatinating execution or to throw for unit testing.
An executable finder specifically designed for the PHP executable.
testFind()
tests find() with the constant PHP_BINARY.
testFindWithHHVM()
tests find() with the env var / constant PHP_BINARY with HHVM.
testFindArguments()
tests find() with the env var PHP_PATH.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27