4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Config\Tests\Definition\Dumper;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Config\Definition\Dumper\XmlReferenceDumper;
16 use Symfony\Component\Config\Tests\Fixtures\Configuration\ExampleConfiguration;
18 class XmlReferenceDumperTest extends TestCase
20 public function testDumper()
22 $configuration = new ExampleConfiguration();
24 $dumper = new XmlReferenceDumper();
25 $this->assertEquals($this->getConfigurationAsString(), $dumper->dump($configuration));
28 public function testNamespaceDumper()
30 $configuration = new ExampleConfiguration();
32 $dumper = new XmlReferenceDumper();
33 $this->assertEquals(str_replace('http://example.org/schema/dic/acme_root', 'http://symfony.com/schema/dic/symfony', $this->getConfigurationAsString()), $dumper->dump($configuration, 'http://symfony.com/schema/dic/symfony'));
36 private function getConfigurationAsString()
38 return str_replace("\n", PHP_EOL, <<<'EOL'
39 <!-- Namespace: http://example.org/schema/dic/acme_root -->
40 <!-- scalar-required: Required -->
41 <!-- enum-with-default: One of "this"; "that" -->
42 <!-- enum: One of "this"; "that" -->
49 scalar-default="default"
51 scalar-array-defaults="elem1,elem2"
53 node-with-a-looong-name=""
54 enum-with-default="this"
60 child3: this is a long
62 which should be indented;
63 Example: example setting
71 <!-- prototype: Parameter name -->
72 <parameter name="parameter name">scalar value</parameter>