ConfigDebugCommandTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
  11. use Symfony\Bundle\FrameworkBundle\Console\Application;
  12. use Symfony\Component\Console\Input\ArrayInput;
  13. use Symfony\Component\Console\Output\NullOutput;
  14. use Symfony\Component\Console\Tester\CommandTester;
  15. /**
  16. * @group functional
  17. */
  18. class ConfigDebugCommandTest extends WebTestCase
  19. {
  20. private $application;
  21. protected function setUp()
  22. {
  23. $kernel = static::createKernel(array('test_case' => 'ConfigDump', 'root_config' => 'config.yml'));
  24. $this->application = new Application($kernel);
  25. $this->application->doRun(new ArrayInput(array()), new NullOutput());
  26. }
  27. public function testDumpBundleName()
  28. {
  29. $tester = $this->createCommandTester();
  30. $ret = $tester->execute(array('name' => 'TestBundle'));
  31. $this->assertSame(0, $ret, 'Returns 0 in case of success');
  32. $this->assertContains('custom: foo', $tester->getDisplay());
  33. }
  34. /**
  35. * @return CommandTester
  36. */
  37. private function createCommandTester()
  38. {
  39. $command = $this->application->find('debug:config');
  40. return new CommandTester($command);
  41. }
  42. }