ReferenceDumperTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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\Config\Tests\Definition;
  11. use Symfony\Component\Config\Definition\ReferenceDumper;
  12. use Symfony\Component\Config\Tests\Fixtures\Configuration\ExampleConfiguration;
  13. class ReferenceDumperTest extends \PHPUnit_Framework_TestCase
  14. {
  15. public function testDumper()
  16. {
  17. $configuration = new ExampleConfiguration();
  18. $dumper = new ReferenceDumper();
  19. $this->assertEquals($this->getConfigurationAsString(), $dumper->dump($configuration));
  20. }
  21. private function getConfigurationAsString()
  22. {
  23. return <<<EOL
  24. root:
  25. boolean: true
  26. scalar_empty: ~
  27. scalar_null: ~
  28. scalar_true: true
  29. scalar_false: false
  30. scalar_default: default
  31. scalar_array_empty: []
  32. scalar_array_defaults:
  33. # Defaults:
  34. - elem1
  35. - elem2
  36. # some info
  37. array:
  38. child1: ~
  39. child2: ~
  40. # this is a long
  41. # multi-line info text
  42. # which should be indented
  43. child3: ~ # Example: example setting
  44. array_prototype:
  45. parameters:
  46. # Prototype
  47. name:
  48. value: ~ # Required
  49. EOL;
  50. }
  51. }