Yaffs site version 1.1
[yaffs-website] / vendor / symfony / config / Tests / Definition / Dumper / XmlReferenceDumperTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Config\Tests\Definition\Dumper;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Config\Definition\Dumper\XmlReferenceDumper;
16 use Symfony\Component\Config\Tests\Fixtures\Configuration\ExampleConfiguration;
17
18 class XmlReferenceDumperTest extends TestCase
19 {
20     public function testDumper()
21     {
22         $configuration = new ExampleConfiguration();
23
24         $dumper = new XmlReferenceDumper();
25         $this->assertEquals($this->getConfigurationAsString(), $dumper->dump($configuration));
26     }
27
28     public function testNamespaceDumper()
29     {
30         $configuration = new ExampleConfiguration();
31
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'));
34     }
35
36     private function getConfigurationAsString()
37     {
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" -->
43 <config
44     boolean="true"
45     scalar-empty=""
46     scalar-null="null"
47     scalar-true="true"
48     scalar-false="false"
49     scalar-default="default"
50     scalar-array-empty=""
51     scalar-array-defaults="elem1,elem2"
52     scalar-required=""
53     node-with-a-looong-name=""
54     enum-with-default="this"
55     enum=""
56 >
57
58     <!-- some info -->
59     <!--
60         child3: this is a long
61                 multi-line info text
62                 which should be indented;
63                 Example: example setting
64     -->
65     <array
66         child1=""
67         child2=""
68         child3=""
69     />
70
71     <!-- prototype: Parameter name -->
72     <parameter name="parameter name">scalar value</parameter>
73
74     <!-- prototype -->
75     <connection
76         user=""
77         pass=""
78     />
79
80 </config>
81
82 EOL
83         );
84     }
85 }