ListCommandTest.php 963 B

12345678910111213141516171819202122232425262728
  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. require_once __DIR__.'/../../../../bootstrap.php';
  10. use Symfony\Components\Console\Tester\CommandTester;
  11. use Symfony\Components\Console\Application;
  12. $t = new LimeTest(2);
  13. $application = new Application();
  14. // ->execute()
  15. $t->diag('->execute()');
  16. $commandTester = new CommandTester($application->getCommand('list'));
  17. $commandTester->execute(array());
  18. $t->like($commandTester->getDisplay(), '/help Displays help for a command/', '->execute() returns a list of available commands');
  19. $commandTester->execute(array('--xml' => true));
  20. $t->like($commandTester->getDisplay(), '/<command id="list" namespace="_global" name="list">/', '->execute() returns a list of available commands in XML if --xml is passed');