/**
     * test that help() outputs subcommands.
     *
     * @return void
     */
    public function testXmlHelpSubcommand()
    {
        $parser = new ConsoleOptionParser('mycommand', false);
        $parser->addSubcommand('method', array('help' => 'This is another command'))->addOption('test', array('help' => 'A test option.'));
        $formatter = new HelpFormatter($parser);
        $result = $formatter->xml();
        $expected = <<<TEXT
<?xml version="1.0"?>
<shell>
<name>mycommand</name>
<description/>
<subcommands>
\t<command name="method" help="This is another command" />
</subcommands>
<options>
\t<option name="--help" short="-h" help="Display this help." boolean="1">
\t\t<default></default>
\t\t<choices></choices>
\t</option>
\t<option name="--test" short="" help="A test option." boolean="0">
\t\t<default></default>
\t\t<choices></choices>
\t</option>
</options>
<arguments/>
<epilog/>
</shell>
TEXT;
        $this->assertEquals(new DomDocument($expected), new DomDocument($result), 'Help does not match');
    }
    /**
     * test that help() with a command param shows the help for a subcommand
     *
     * @return void
     */
    public function testHelpSubcommandHelp()
    {
        $subParser = new ConsoleOptionParser('method', FALSE);
        $subParser->addOption('connection', array('help' => 'Db connection.'));
        $parser = new ConsoleOptionParser('mycommand', FALSE);
        $parser->addSubcommand('method', array('help' => 'This is another command', 'parser' => $subParser))->addOption('test', array('help' => 'A test option.'));
        $result = $parser->help('method');
        $expected = <<<TEXT
<info>Usage:</info>
cake mycommand method [-h] [--connection]

<info>Options:</info>

--help, -h        Display this help.
--connection      Db connection.

TEXT;
        $this->assertTextEquals($expected, $result, 'Help is not correct.');
    }