output .= $message; } } /** * Class CommandListShellTest * */ class CommandListShellTest extends TestCase { /** * setUp method * * @return void */ public function setUp() { parent::setUp(); Plugin::load(array('TestPlugin', 'TestPluginTwo')); $this->out = new TestStringOutput(); $io = new ConsoleIo($this->out); $this->Shell = $this->getMock( 'Cake\Shell\CommandListShell', ['in', 'err', '_stop', 'clear'], [$io] ); $this->Shell->Command = $this->getMock( 'Cake\Shell\Task\CommandTask', ['in', '_stop', 'err', 'clear'], [$io] ); } /** * tearDown * * @return void */ public function tearDown() { parent::tearDown(); unset($this->Shell); Plugin::unload(); } /** * test that main finds core shells. * * @return void */ public function testMain() { $this->Shell->main(); $output = $this->out->output; $expected = "/\[.*TestPlugin.*\] example/"; $this->assertRegExp($expected, $output); $expected = "/\[.*TestPluginTwo.*\] example, welcome/"; $this->assertRegExp($expected, $output); $expected = "/\[.*CORE.*\] bake, i18n, orm_cache, server, test/"; $this->assertRegExp($expected, $output); $expected = "/\[.*app.*\] sample/"; $this->assertRegExp($expected, $output); } /** * test xml output. * * @return void */ public function testMainXml() { $this->assertFalse(defined('HHVM_VERSION'), 'Remove when travis updates to hhvm 2.5'); $this->Shell->params['xml'] = true; $this->Shell->main(); $output = $this->out->output; $find = ''; $this->assertContains($find, $output); $find = ''; $this->assertContains($find, $output); $find = ''; $this->assertContains($find, $output); } }