Skip to content

Commit

Permalink
PhpInterpreter: added addPhpIniOption() (BC break)
Browse files Browse the repository at this point in the history
  • Loading branch information
milo authored and dg committed Apr 17, 2016
1 parent 9ed983a commit 80e0431
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 5 deletions.
12 changes: 11 additions & 1 deletion src/Runner/HhvmPhpInterpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class HhvmPhpInterpreter implements PhpInterpreter
{
/** @var string HHVM arguments */
public $arguments;
private $arguments;

/** @var string HHVM executable */
private $path;
Expand Down Expand Up @@ -59,6 +59,16 @@ public function __construct($path, $args = NULL)
}


/**
* @param string
* @param string
*/
public function addPhpIniOption($name, $value = NULL)
{
$this->arguments .= ' -d ' . Helpers::escapeArg($name . ($value === NULL ? '' : "=$value"));
}


/**
* @return string
*/
Expand Down
6 changes: 6 additions & 0 deletions src/Runner/PhpInterpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
interface PhpInterpreter
{

/**
* @param string
* @param string
*/
function addPhpIniOption($name, $value = NULL);

/**
* @return string
*/
Expand Down
3 changes: 2 additions & 1 deletion src/Runner/TestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ private function initiatePhpVersion($version, PhpInterpreter $interpreter)

private function initiatePhpIni($value, PhpInterpreter $interpreter)
{
$interpreter->arguments .= ' -d ' . Helpers::escapeArg($value);
list($name, $value) = explode('=', $value, 2) + [1 => NULL];
$interpreter->addPhpIniOption($name, $value);
}


Expand Down
12 changes: 11 additions & 1 deletion src/Runner/ZendPhpDbgInterpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class ZendPhpDbgInterpreter implements PhpInterpreter
{
/** @var string PHP arguments */
public $arguments;
private $arguments;

/** @var string PHP executable */
private $path;
Expand Down Expand Up @@ -55,6 +55,16 @@ public function __construct($path, $args = NULL)
}


/**
* @param string
* @param string
*/
public function addPhpIniOption($name, $value = NULL)
{
$this->arguments .= ' -d ' . Helpers::escapeArg($name . ($value === NULL ? '' : "=$value"));
}


/**
* @return string
*/
Expand Down
12 changes: 11 additions & 1 deletion src/Runner/ZendPhpInterpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class ZendPhpInterpreter implements PhpInterpreter
{
/** @var string PHP arguments */
public $arguments;
private $arguments;

/** @var string PHP executable */
private $path;
Expand Down Expand Up @@ -63,6 +63,16 @@ public function __construct($path, $args = NULL)
}


/**
* @param string
* @param string
*/
public function addPhpIniOption($name, $value = NULL)
{
$this->arguments .= ' -d ' . Helpers::escapeArg($name . ($value === NULL ? '' : "=$value"));
}


/**
* @return string
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Runner/Runner.multiple-fails.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class Logger implements Tester\Runner\OutputHandler
}

$interpreter = createInterpreter();
$interpreter->arguments .= ' -d display_errors=On -d html_errors=Off';
$interpreter->addPhpIniOption('display_errors', 'on');
$interpreter->addPhpIniOption('html_errors', 'off');

$runner = new Runner($interpreter);
$runner->paths[] = __DIR__ . '/multiple-fails/*.phptx';
Expand Down

0 comments on commit 80e0431

Please sign in to comment.