Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

tests: PhpExecutable uses proper php.ini #109

Closed
wants to merge 1 commit into from

2 participants

@milo
Collaborator

No description provided.

@milo
Collaborator

Maybe related to #88

@dg
Owner
dg commented

-c can be "empty", so what about shorter

$php = new Tester\Runner\PhpExecutable(PHP_BINARY, '-n -c ' . Tester\Helpers::escapeArg(php_ini_loaded_file()));
$runner = new Tester\Runner\Runner($php);
@dg dg referenced this pull request from a commit in dg/tester
@dg dg tests: PhpExecutable uses proper php.ini [Closes #109] 35b0081
@milo
Collaborator

@dg That's better. Should I update PR or will you close it by your commit? Btw. I found it in PhpExecutable.phpt too.

@dg
Owner
dg commented

What do you think about default -n, direct in PhpExecutable or Job class?

@milo
Collaborator

Part of PhpExecutable is better. I think that default php.ini should be always prohibited for Tester's purpose.

@dg dg closed this in 5c5ecba
@milo milo deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 6, 2014
  1. @milo
This page is out of date. Refresh to see the latest.
View
6 tests/Runner.annotations.phpt
@@ -9,10 +9,6 @@ require __DIR__ . '/../Tester/Runner/TestHandler.php';
require __DIR__ . '/../Tester/Runner/PhpExecutable.php';
require __DIR__ . '/../Tester/Runner/Runner.php';
-if (PHP_VERSION_ID < 50400) {
- Tester\Environment::skip('Requires constant PHP_BINARY available since PHP 5.4.0');
-}
-
class Logger implements Tester\Runner\OutputHandler
{
@@ -27,7 +23,7 @@ class Logger implements Tester\Runner\OutputHandler
function end() {}
}
-$runner = new Tester\Runner\Runner(new Tester\Runner\PhpExecutable(PHP_BINARY));
+$runner = new Tester\Runner\Runner(createPhp());
$runner->paths[] = __DIR__ . '/annotations/*.phptx';
$runner->outputHandlers[] = $logger = new Logger;
$runner->run();
View
6 tests/Runner.edge.phpt
@@ -9,10 +9,6 @@ require __DIR__ . '/../Tester/Runner/TestHandler.php';
require __DIR__ . '/../Tester/Runner/PhpExecutable.php';
require __DIR__ . '/../Tester/Runner/Runner.php';
-if (PHP_VERSION_ID < 50400) {
- Tester\Environment::skip('Requires constant PHP_BINARY available since PHP 5.4.0');
-}
-
class Logger implements Tester\Runner\OutputHandler
{
@@ -27,7 +23,7 @@ class Logger implements Tester\Runner\OutputHandler
function end() {}
}
-$runner = new Tester\Runner\Runner(new Tester\Runner\PhpExecutable(PHP_BINARY));
+$runner = new Tester\Runner\Runner(createPhp());
$runner->paths[] = __DIR__ . '/edge/*.phptx';
$runner->outputHandlers[] = $logger = new Logger;
$runner->run();
View
6 tests/Runner.multiple-fails.phpt
@@ -10,10 +10,6 @@ require __DIR__ . '/../Tester/Runner/TestHandler.php';
require __DIR__ . '/../Tester/Runner/PhpExecutable.php';
require __DIR__ . '/../Tester/Runner/Runner.php';
-if (PHP_VERSION_ID < 50400) {
- Tester\Environment::skip('Requires constant PHP_BINARY available since PHP 5.4.0');
-}
-
class Logger implements Tester\Runner\OutputHandler
{
@@ -28,7 +24,7 @@ class Logger implements Tester\Runner\OutputHandler
function end() {}
}
-$php = new Tester\Runner\PhpExecutable(PHP_BINARY);
+$php = createPhp();
$php->arguments .= ' -d display_errors=On -d html_errors=Off';
$runner = new Runner($php);
View
6 tests/Runner.multiple.phpt
@@ -8,12 +8,8 @@ require __DIR__ . '/../Tester/Runner/TestHandler.php';
require __DIR__ . '/../Tester/Runner/PhpExecutable.php';
require __DIR__ . '/../Tester/Runner/Runner.php';
-if (PHP_VERSION_ID < 50400) {
- Tester\Environment::skip('Requires constant PHP_BINARY available since PHP 5.4.0');
-}
-
-$runner = new Tester\Runner\Runner(new Tester\Runner\PhpExecutable(PHP_BINARY));
+$runner = new Tester\Runner\Runner(createPhp());
$tests = Assert::with($runner, function() {
$this->results = array(self::PASSED => 0, self::SKIPPED => 0, self::FAILED => 0);
View
18 tests/bootstrap.php
@@ -14,3 +14,21 @@ function test(\Closure $function)
{
$function();
}
+
+
+/**
+ * @return Tester\Runner\PhpExecutable
+ */
+function createPhp()
+{
+ if (PHP_VERSION_ID < 50400) {
+ Tester\Environment::skip('Requires constant PHP_BINARY available since PHP 5.4.0');
+ }
+
+ $args = '-n';
+ if (($ini = php_ini_loaded_file()) !== FALSE) {
+ $args .= ' -c ' . Tester\Helpers::escapeArg($ini);
+ }
+
+ return new Tester\Runner\PhpExecutable(PHP_BINARY, $args);
+}
Something went wrong with that request. Please try again.