Skip to content
Permalink
Browse files

Remove empty array when plugin requires nothing

  • Loading branch information...
jadb committed Jul 5, 2015
1 parent 193917d commit a743dacc59de19ae2ee74614a5a0a535cbc7d633
Showing with 23 additions and 1 deletion.
  1. +1 −1 src/Shell/Task/LoadTask.php
  2. +22 −0 tests/TestCase/Shell/Task/LoadTaskTest.php
@@ -76,7 +76,7 @@ protected function _modifyBootstrap($plugin, $hasBootstrap, $hasRoutes, $hasAuto
$append = "\nPlugin::load('%s', [%s]);\n";
$options = implode(', ', array_filter([$autoloadString, $bootstrapString, $routesString]));
$bootstrap->append(sprintf($append, $plugin, $options));
$bootstrap->append(str_replace(', []', '', sprintf($append, $plugin, $options)));
$this->out('');
$this->out(sprintf('%s modified', $this->bootstrap));
return true;
@@ -145,4 +145,26 @@ public function testLoadNoAutoload()
$bootstrap = new File($this->bootstrap, false);
$this->assertContains($expected, $bootstrap->read());
}
/**
* testLoad
*
* @return void
*/
public function testLoadNothing()
{
$this->Task->params = [
'bootstrap' => false,
'routes' => false,
'autoload' => false,
];
$action = $this->Task->main('TestPlugin');
$this->assertTrue($action);
$expected = "Plugin::load('TestPlugin');";
$bootstrap = new File($this->bootstrap, false);
$this->assertContains($expected, $bootstrap->read());
}
}

0 comments on commit a743dac

Please sign in to comment.
You can’t perform that action at this time.