ListCommandTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /*
  3. * This file is part of the symfony package.
  4. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. namespace Symfony\Tests\Components\Console\Command;
  10. require_once __DIR__.'/../../../bootstrap.php';
  11. use Symfony\Components\Console\Tester\CommandTester;
  12. use Symfony\Components\Console\Application;
  13. class ListCommandTest extends \PHPUnit_Framework_TestCase
  14. {
  15. public function testExecute()
  16. {
  17. $application = new Application();
  18. $commandTester = new CommandTester($application->getCommand('list'));
  19. $commandTester->execute(array());
  20. $this->assertRegExp('/help Displays help for a command/', $commandTester->getDisplay(), '->execute() returns a list of available commands');
  21. $commandTester->execute(array('--xml' => true));
  22. $this->assertRegExp('/<command id="list" namespace="_global" name="list">/', $commandTester->getDisplay(), '->execute() returns a list of available commands in XML if --xml is passed');
  23. }
  24. }