JsonDescriptorTest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  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\Component\Console\Tests\Descriptor;
  11. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  12. use Symfony\Component\Console\Output\BufferedOutput;
  13. class JsonDescriptorTest extends AbstractDescriptorTest
  14. {
  15. protected function getDescriptor()
  16. {
  17. return new JsonDescriptor();
  18. }
  19. protected function getFormat()
  20. {
  21. return 'json';
  22. }
  23. protected function assertDescription($expectedDescription, $describedObject)
  24. {
  25. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  26. $this->getDescriptor()->describe($output, $describedObject, array('raw_output' => true));
  27. $this->assertEquals(json_decode(trim($expectedDescription), true), json_decode(trim(str_replace(PHP_EOL, "\n", $output->fetch())), true));
  28. }
  29. }