Permalink
Browse files

PhpInterpreter changed to immutable object

  • Loading branch information...
dg committed Aug 18, 2017
1 parent 2c65e44 commit bf91dd7cf530ee11dd9ad489b488289b46b73d4c
Showing with 11 additions and 8 deletions.
  1. +5 βˆ’2 src/Runner/PhpInterpreter.php
  2. +3 βˆ’3 src/Runner/TestHandler.php
  3. +3 βˆ’3 tests/Runner/Runner.multiple-fails.phpt
@@ -85,10 +85,13 @@ public function __construct($path, array $args = [])
/**
* @param string
* @param string
* @return static
*/
public function addPhpIniOption($name, $value = null)
public function withPhpIniOption($name, $value = null)
{
$this->commandLine .= ' -d ' . Helpers::escapeArg($name . ($value === null ? '' : "=$value"));
$me = clone $this;
$me->commandLine .= ' -d ' . Helpers::escapeArg($name . ($value === null ? '' : "=$value"));
return $me;
}
@@ -37,7 +37,7 @@ public function __construct(Runner $runner)
public function initiate($file)
{
list($annotations, $title) = $this->getAnnotations($file);
$php = clone $this->runner->getInterpreter();
$php = $this->runner->getInterpreter();
$tests = [new Test($file, $title)];
foreach (get_class_methods($this) as $method) {
@@ -128,10 +128,10 @@ private function initiatePhpExtension(Test $test, $value, PhpInterpreter $interp
}
private function initiatePhpIni(Test $test, $pair, PhpInterpreter $interpreter)
private function initiatePhpIni(Test $test, $pair, PhpInterpreter &$interpreter)
{
list($name, $value) = explode('=', $pair, 2) + [1 => null];
$interpreter->addPhpIniOption($name, $value);
$interpreter = $interpreter->withPhpIniOption($name, $value);
}
@@ -38,9 +38,9 @@ class Logger implements Tester\Runner\OutputHandler
}
}
$interpreter = createInterpreter();
$interpreter->addPhpIniOption('display_errors', 'on');
$interpreter->addPhpIniOption('html_errors', 'off');
$interpreter = createInterpreter()
->withPhpIniOption('display_errors', 'on')
->withPhpIniOption('html_errors', 'off');
$runner = new Runner($interpreter);
$runner->paths[] = __DIR__ . '/multiple-fails/*.phptx';

0 comments on commit bf91dd7

Please sign in to comment.