Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / symfony / console / Symfony / Component / Console / Tests / Command / HelpCommandTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Console\Tests\Command;
13
14 use Symfony\Component\Console\Tester\CommandTester;
15 use Symfony\Component\Console\Command\HelpCommand;
16 use Symfony\Component\Console\Command\ListCommand;
17 use Symfony\Component\Console\Application;
18
19 class HelpCommandTest extends \PHPUnit_Framework_TestCase
20 {
21     public function testExecute()
22     {
23         $command = new HelpCommand();
24
25         $commandTester = new CommandTester($command);
26         $command->setCommand(new ListCommand());
27         $commandTester->execute(array());
28         $this->assertRegExp('/list \[--xml\] \[--raw\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
29
30         $command->setCommand(new ListCommand());
31         $commandTester->execute(array('--xml' => true));
32         $this->assertRegExp('/<command/', $commandTester->getDisplay(), '->execute() returns an XML help text if --xml is passed');
33
34         $application = new Application();
35         $commandTester = new CommandTester($application->get('help'));
36         $commandTester->execute(array('command_name' => 'list'));
37         $this->assertRegExp('/list \[--xml\] \[--raw\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
38
39         $commandTester->execute(array('command_name' => 'list', '--xml' => true));
40         $this->assertRegExp('/<command/', $commandTester->getDisplay(), '->execute() returns an XML help text if --xml is passed');
41     }
42 }