output .= $message;
}
}
class CommandListShellTest extends CakeTestCase {
/**
* setUp method
*
* @return void
*/
public function setUp() {
parent::setUp();
App::build(array(
'Plugin' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS
),
'Console/Command' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'Console' . DS . 'Command' . DS
)
), App::RESET);
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'));
$out = new TestStringOutput();
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Shell = $this->getMock(
'CommandListShell',
array('in', '_stop', 'clear'),
array($out, $out, $in)
);
}
/**
* tearDown
*
* @return void
*/
public function tearDown() {
parent::tearDown();
unset($this->Shell);
CakePlugin::unload();
}
/**
* test that main finds core shells.
*
* @return void
*/
public function testMain() {
$this->Shell->main();
$output = $this->Shell->stdout->output;
$expected = "/\[.*TestPlugin.*\] example/";
$this->assertRegExp($expected, $output);
$expected = "/\[.*TestPluginTwo.*\] example, welcome/";
$this->assertRegExp($expected, $output);
$expected = "/\[.*CORE.*\] acl, api, bake, command_list, console, i18n, schema, server, test, testsuite, upgrade/";
$this->assertRegExp($expected, $output);
$expected = "/\[.*app.*\] sample/";
$this->assertRegExp($expected, $output);
}
/**
* test xml output.
*
* @return void
*/
public function testMainXml() {
$this->Shell->params['xml'] = true;
$this->Shell->main();
$output = $this->Shell->stdout->output;
$find = '';
$this->assertContains($find, $output);
$find = '';
$this->assertContains($find, $output);
$find = '';
$this->assertContains($find, $output);
}
}