Merge pull request #27 from kamermans/master

Build error: Fatal error: Using $this when not in object context
This commit is contained in:
Dan Cryer 2013-05-16 01:46:00 -07:00
commit 9848fa42d9
4 changed files with 29 additions and 11 deletions

3
.gitignore vendored
View file

@ -4,3 +4,6 @@ composer.lock
composer.phar
config.php
.DS_Store
.settings/
.project
.buildpath

View file

@ -96,17 +96,17 @@ class Builder
if(is_array($message))
{
$cb = $this->logCallback;
$message = array_map(function($item) use ($cb, $prefix)
foreach ($message as $item)
{
if(is_callable($cb))
if(is_callable($this->logCallback))
{
$cb($prefix . $item);
$this->logCallback($prefix . $item);
}
$this->log .= $prefix . $item . PHP_EOL;
}, $message);
}
}
else
{

View file

@ -7,10 +7,15 @@ class PhpUnit implements \PHPCI\Plugin
protected $directory;
protected $args;
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;
public function __construct(\PHPCI\Builder $phpci, array $options = array())
@ -18,6 +23,7 @@ class PhpUnit implements \PHPCI\Plugin
$this->phpci = $phpci;
$this->directory = isset($options['directory']) ? $options['directory'] : 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'] : '';
}
@ -48,7 +54,15 @@ class PhpUnit implements \PHPCI\Plugin
}
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;
}
}

View file

@ -87,6 +87,7 @@ Similar to Travis CI, to support PHPCI in your project, you simply need to add a
- "PHPUnit-ubuntu-fix.xml"
directory:
- "tests/"
run_from: "phpunit/"
php_mess_detector:
allow_failures: true
php_code_sniffer: