Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/commands/PhpUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class PhpUnit extends Command

private $options;

private $phpInterpreter;


/**
* Returns working directory. System will switch to this directory before running tests
Expand Down Expand Up @@ -46,6 +48,23 @@ public function getTarget()
return $this->target;
}

/**
* Returns PHP interpreter.
* @return string
*/
public function getPhpInterpreter()
{
return $this->phpInterpreter ?: 'php';
}

/**
* Sets PHP interpreter in your system (e.g. php, php5.6, php7.0...).
* @return string
*/
public function setPhpInterpreter($phpInterpreter)
{
$this->phpInterpreter = $phpInterpreter;
}

/**
* Sets target to be executed. Dir in working directory, dot (current dir), TestFile, etc
Expand Down Expand Up @@ -90,7 +109,7 @@ public function execute()
if (!is_file($this->options['xdebugExtensionFile'])) { // PHP is quite when extension file does not exists
$this->error("Xdebug extension file '{$this->options['xdebugExtensionFile']}' does not exists.");
}
$cmd .= 'php -d zend_extension=' . escapeshellarg($this->options['xdebugExtensionFile']) . ' ';
$cmd .= $this->getPhpInterpreter() . ' -d zend_extension=' . escapeshellarg($this->options['xdebugExtensionFile']) . ' ';
}
$cmd .= escapeshellarg($this->options['executable']) . ' ';
$cmd .= escapeshellarg($this->target) . ' ';
Expand Down