Merge pull request #27 from kamermans/master
Build error: Fatal error: Using $this when not in object context
This commit is contained in:
commit
9848fa42d9
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -4,3 +4,6 @@ composer.lock
|
||||||
composer.phar
|
composer.phar
|
||||||
config.php
|
config.php
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.settings/
|
||||||
|
.project
|
||||||
|
.buildpath
|
||||||
|
|
|
@ -96,17 +96,17 @@ class Builder
|
||||||
|
|
||||||
if(is_array($message))
|
if(is_array($message))
|
||||||
{
|
{
|
||||||
$cb = $this->logCallback;
|
|
||||||
|
foreach ($message as $item)
|
||||||
$message = array_map(function($item) use ($cb, $prefix)
|
|
||||||
{
|
{
|
||||||
if(is_callable($cb))
|
if(is_callable($this->logCallback))
|
||||||
{
|
{
|
||||||
$cb($prefix . $item);
|
$this->logCallback($prefix . $item);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->log .= $prefix . $item . PHP_EOL;
|
$this->log .= $prefix . $item . PHP_EOL;
|
||||||
}, $message);
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,10 +7,15 @@ class PhpUnit implements \PHPCI\Plugin
|
||||||
protected $directory;
|
protected $directory;
|
||||||
protected $args;
|
protected $args;
|
||||||
protected $phpci;
|
protected $phpci;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $runFrom When running PHPUnit with an XML config, the command is run from this directory
|
||||||
|
*/
|
||||||
|
protected $runFrom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $xmlConfigFile The path of an xml config for PHPUnit
|
* @var string $xmlConfigFile The path of an xml config for PHPUnit
|
||||||
*/
|
*/
|
||||||
protected $xmlConfigFile;
|
protected $xmlConfigFile;
|
||||||
|
|
||||||
public function __construct(\PHPCI\Builder $phpci, array $options = array())
|
public function __construct(\PHPCI\Builder $phpci, array $options = array())
|
||||||
|
@ -18,6 +23,7 @@ class PhpUnit implements \PHPCI\Plugin
|
||||||
$this->phpci = $phpci;
|
$this->phpci = $phpci;
|
||||||
$this->directory = isset($options['directory']) ? $options['directory'] : null;
|
$this->directory = isset($options['directory']) ? $options['directory'] : null;
|
||||||
$this->xmlConfigFile = isset($options['config']) ? $options['config'] : null;
|
$this->xmlConfigFile = isset($options['config']) ? $options['config'] : null;
|
||||||
|
$this->runFrom = isset($options['run_from']) ? $options['run_from'] : null;
|
||||||
$this->args = isset($options['args']) ? $options['args'] : '';
|
$this->args = isset($options['args']) ? $options['args'] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +54,15 @@ class PhpUnit implements \PHPCI\Plugin
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $this->phpci->executeCommand(PHPCI_BIN_DIR . 'phpunit ' . $this->args . ' -c ' . $this->phpci->buildPath . $configPath);
|
if ($this->runFrom) {
|
||||||
|
$curdir = getcwd();
|
||||||
|
chdir($this->phpci->buildPath.'/'.$this->runFrom);
|
||||||
|
}
|
||||||
|
$success = $this->phpci->executeCommand(PHPCI_BIN_DIR . 'phpunit ' . $this->args . ' -c ' . $this->phpci->buildPath . $configPath);
|
||||||
|
if ($this->runFrom) {
|
||||||
|
chdir($curdir);
|
||||||
|
}
|
||||||
|
return $success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ Similar to Travis CI, to support PHPCI in your project, you simply need to add a
|
||||||
- "PHPUnit-ubuntu-fix.xml"
|
- "PHPUnit-ubuntu-fix.xml"
|
||||||
directory:
|
directory:
|
||||||
- "tests/"
|
- "tests/"
|
||||||
|
run_from: "phpunit/"
|
||||||
php_mess_detector:
|
php_mess_detector:
|
||||||
allow_failures: true
|
allow_failures: true
|
||||||
php_code_sniffer:
|
php_code_sniffer:
|
||||||
|
|
Loading…
Reference in a new issue