setAppNamespace();
$this->loadPlugins(['TestPlugin']);
}
/**
* tearDown
*/
public function tearDown(): void
{
parent::tearDown();
$this->clearPlugins();
}
/**
* Test the command listing fallback when no commands are set
*/
public function testMainNoCommandsFallback(): void
{
$this->exec('help');
$this->assertExitCode(CommandInterface::CODE_SUCCESS);
$this->assertCommandList();
$this->clearPlugins();
}
/**
* Test the command listing
*/
public function testMain(): void
{
$this->exec('help');
$this->assertExitCode(CommandInterface::CODE_SUCCESS);
$this->assertCommandList();
}
/**
* Assert the help output.
*/
protected function assertCommandList(): void
{
$this->assertOutputContains('TestPlugin', 'plugin header should appear');
$this->assertOutputContains('- sample', 'plugin command should appear');
$this->assertOutputNotContains(
'- test_plugin.sample',
'only short alias for plugin command.'
);
$this->assertOutputNotContains(
' - abstract',
'Abstract command classes should not appear.'
);
$this->assertOutputContains('App', 'app header should appear');
$this->assertOutputContains('- sample', 'app shell');
$this->assertOutputContains('CakePHP', 'cakephp header should appear');
$this->assertOutputContains('- routes', 'core shell');
$this->assertOutputContains('- sample', 'short plugin name');
$this->assertOutputContains('- abort', 'command object');
$this->assertOutputContains('To run a command', 'more info present');
$this->assertOutputContains('To get help', 'more info present');
$this->assertOutputContains('This is a demo command', 'command description missing');
}
/**
* Test help --xml
*/
public function testMainAsXml(): void
{
$this->exec('help --xml');
$this->assertExitCode(CommandInterface::CODE_SUCCESS);
$this->assertOutputContains('');
$find = 'assertOutputContains($find);
$find = 'assertOutputContains($find);
$find = 'assertOutputContains($find);
}
}