ListCommandTest.php 1.1 KB

1234567891011121314151617181920212223242526272829
  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. use Symfony\Components\Console\Tester\CommandTester;
  11. use Symfony\Components\Console\Application;
  12. class ListCommandTest extends \PHPUnit_Framework_TestCase
  13. {
  14. public function testExecute()
  15. {
  16. $application = new Application();
  17. $commandTester = new CommandTester($application->getCommand('list'));
  18. $commandTester->execute(array());
  19. $this->assertRegExp('/help Displays help for a command/', $commandTester->getDisplay(), '->execute() returns a list of available commands');
  20. $commandTester->execute(array('--xml' => true));
  21. $this->assertRegExp('/<command id="list" namespace="_global" name="list">/', $commandTester->getDisplay(), '->execute() returns a list of available commands in XML if --xml is passed');
  22. }
  23. }