out = new ConsoleOutput(); $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->messages(); $output = implode("\n", $output); $expected = "/\[.*TestPlugin.*\] example/"; $this->assertRegExp($expected, $output); $expected = "/\[.*TestPluginTwo.*\] example, unique, welcome/"; $this->assertRegExp($expected, $output); $expected = "/\[.*CORE.*\] cache, i18n, orm_cache, plugin, routes, server/"; $this->assertRegExp($expected, $output); $expected = "/\[.*app.*\] i18m, sample/"; $this->assertRegExp($expected, $output); } /** * If there is an app shell with the same name as a core shell, * tests that the app shell is the one displayed and the core one is hidden. * * @return void */ public function testMainAppPriority() { rename(APP . 'Shell' . DS . 'I18mShell.php', APP . 'Shell' . DS . 'I18nShell.php'); $this->Shell->main(); $output = $this->out->messages(); $output = implode("\n", $output); rename(APP . 'Shell' . DS . 'I18nShell.php', APP . 'Shell' . DS . 'I18mShell.php'); $expected = "/\[.*CORE.*\] cache, orm_cache, plugin, routes, server/"; $this->assertRegExp($expected, $output); $expected = "/\[.*app.*\] i18n, sample/"; $this->assertRegExp($expected, $output); } /** * test xml output. * * @return void */ public function testMainXml() { $this->Shell->params['xml'] = true; $this->Shell->main(); $output = $this->out->messages(); $output = implode("\n", $output); $find = 'assertContains($find, $output); $find = 'assertContains($find, $output); $find = 'assertContains($find, $output); } }