diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2014-01-17 20:50:25 -0600 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2014-01-17 20:50:25 -0600 |
commit | ce8b8593e0e742be8ce89a8c90dfad5431ceb059 (patch) | |
tree | 8b66500383fe91aa8983e87a0cc2d7ce9f0c4c5a /tests | |
parent | 8486d6a9d15f2f483383286f39abe474917c95ad (diff) | |
parent | 90f3cc48e572b25fa9affe156626632ab7b2b70c (diff) | |
download | forums-ce8b8593e0e742be8ce89a8c90dfad5431ceb059.tar forums-ce8b8593e0e742be8ce89a8c90dfad5431ceb059.tar.gz forums-ce8b8593e0e742be8ce89a8c90dfad5431ceb059.tar.bz2 forums-ce8b8593e0e742be8ce89a8c90dfad5431ceb059.tar.xz forums-ce8b8593e0e742be8ce89a8c90dfad5431ceb059.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/12046] Use PHP_BINARY environment variable in PHP lint test.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lint_test.php | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/lint_test.php b/tests/lint_test.php index eba117839b..b0149063bd 100644 --- a/tests/lint_test.php +++ b/tests/lint_test.php @@ -9,17 +9,30 @@ class phpbb_lint_test extends phpbb_test_case { + static protected $php_binary; static protected $exclude; static public function setUpBeforeClass() { + // Try to use PHP_BINARY constant if available so lint tests are run + // using the same php binary as phpunit. If not available (pre PHP + // 5.4), assume binary is called 'php' and is in PATH. + self::$php_binary = defined('PHP_BINARY') ? escapeshellcmd(PHP_BINARY) : 'php'; + $output = array(); $status = 1; - exec('(php -v) 2>&1', $output, $status); + exec(sprintf('(%s --version) 2>&1', self::$php_binary), $output, $status); if ($status) { $output = implode("\n", $output); - self::markTestSkipped("php is not in PATH or broken: $output"); + if (self::$php_binary === 'php') + { + self::markTestSkipped(sprintf('php is not in PATH or broken. Output: %s', $output)); + } + else + { + self::markTestSkipped(sprintf('Could not run PHP_BINARY %s. Output: %s', self::$php_binary, $output)); + } } self::$exclude = array( @@ -65,13 +78,12 @@ class phpbb_lint_test extends phpbb_test_case } else if (substr($filename, strlen($filename)-4) == '.php') { - // assume php binary is called php and it is in PATH - $cmd = '(php -l ' . escapeshellarg($path) . ') 2>&1'; + $cmd = sprintf('(%s -l %s) 2>&1', self::$php_binary, escapeshellarg($path)); $output = array(); $status = 1; exec($cmd, $output, $status); $output = implode("\n", $output); - $this->assertEquals(0, $status, "php -l failed for $path:\n$output"); + $this->assertEquals(0, $status, "PHP lint failed for $path:\n$output"); } } } |