File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony WebpackEncoreBundle package.
5
+ * (c) Fabien Potencier <[email protected] >
6
+ * For the full copyright and license information, please view the LICENSE
7
+ * file that was distributed with this source code.
8
+ */
9
+
10
+ namespace Symfony \WebpackEncoreBundle \Tests \Dto ;
11
+
12
+ use PHPUnit \Framework \TestCase ;
13
+ use Symfony \WebpackEncoreBundle \Dto \StimulusOutletsDto ;
14
+ use Twig \Environment ;
15
+ use Twig \Loader \ArrayLoader ;
16
+
17
+ class StimulusOutletsDtoTest extends TestCase
18
+ {
19
+ /**
20
+ * @var StimulusOutletsDto
21
+ */
22
+ private $ stimulusOutletsDto ;
23
+
24
+ protected function setUp (): void
25
+ {
26
+ $ this ->stimulusOutletsDto = new StimulusOutletsDto (new Environment (new ArrayLoader ()));
27
+ }
28
+
29
+ public function testToStringEscapingAttributeValues (): void
30
+ {
31
+ $ this ->stimulusOutletsDto ->addOutlet ('foo ' , 'bar ' , '" ' );
32
+ $ attributesHtml = (string ) $ this ->stimulusOutletsDto ;
33
+ self ::assertSame ('data-foo-bar-outlet=""" ' , $ attributesHtml );
34
+ }
35
+
36
+ public function testToArrayNoEscapingAttributeValues (): void
37
+ {
38
+ $ this ->stimulusOutletsDto ->addOutlet ('foo ' , 'bar ' , '" ' );
39
+ $ attributesArray = $ this ->stimulusOutletsDto ->toArray ();
40
+ self ::assertSame (['data-foo-bar-outlet ' => '" ' ], $ attributesArray );
41
+ }
42
+ }
You can’t perform that action at this time.
0 commit comments