ConfigDumpReferenceCommandTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 ConfigDumpReferenceCommandTest 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('test:', $tester->getDisplay());
  33. $this->assertContains(' custom:', $tester->getDisplay());
  34. }
  35. /**
  36. * @return CommandTester
  37. */
  38. private function createCommandTester()
  39. {
  40. $command = $this->application->find('config:dump-reference');
  41. return new CommandTester($command);
  42. }
  43. }