Fixed plugins execution
This commit is contained in:
parent
9fdfa967a7
commit
041ab16e71
|
@ -176,21 +176,17 @@ class Executor
|
||||||
*/
|
*/
|
||||||
public function executePlugin($plugin, $options)
|
public function executePlugin($plugin, $options)
|
||||||
{
|
{
|
||||||
// Any plugin name without a namespace separator is a PHPCI built in plugin
|
$class = $plugin;
|
||||||
// if not we assume it's a fully name-spaced class name that implements the plugin interface.
|
if (!class_exists($class)) {
|
||||||
// If not the factory will throw an exception.
|
|
||||||
if (strpos($plugin, '\\') === false) {
|
|
||||||
$class = str_replace('_', ' ', $plugin);
|
$class = str_replace('_', ' ', $plugin);
|
||||||
$class = ucwords($class);
|
$class = ucwords($class);
|
||||||
$class = 'PHPCensor\\Plugin\\' . str_replace(' ', '', $class);
|
$class = 'PHPCensor\\Plugin\\' . str_replace(' ', '', $class);
|
||||||
} else {
|
|
||||||
$class = $plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!class_exists($class)) {
|
if (!class_exists($class)) {
|
||||||
$this->logger->logFailure(sprintf('Plugin does not exist: %s', $plugin));
|
$this->logger->logFailure(sprintf('Plugin does not exist: %s', $plugin));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -100,8 +100,8 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$options = [];
|
$options = [];
|
||||||
$pluginName = 'DOESNTEXIST';
|
$pluginName = 'DOESNTEXIST';
|
||||||
|
|
||||||
$this->mockBuildLogger->logFailure('Plugin does not exist: ' . $pluginName)->shouldBeCalledTimes(1);
|
$this->mockBuildLogger->logFailure(sprintf('Plugin does not exist: %s', $pluginName))->shouldBeCalledTimes(1);
|
||||||
|
|
||||||
$this->testedExecutor->executePlugin($pluginName, $options);
|
$this->testedExecutor->executePlugin($pluginName, $options);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue