43
43
use Symfony \UX \LiveComponent \Tests \Fixtures \Enum \ZeroIntEnum ;
44
44
use Symfony \UX \LiveComponent \Tests \LiveComponentTestHelper ;
45
45
use Symfony \UX \TwigComponent \ComponentAttributes ;
46
- use Symfony \UX \TwigComponent \ComponentAttributesFactory ;
47
46
use Symfony \UX \TwigComponent \ComponentMetadata ;
47
+ use Twig \Environment ;
48
+ use Twig \Runtime \EscaperRuntime ;
48
49
use Zenstruck \Foundry \Test \Factories ;
49
50
use Zenstruck \Foundry \Test \ResetDatabase ;
50
51
@@ -76,9 +77,9 @@ private function executeHydrationTestCase(callable $testFactory, ?int $minPhpVer
76
77
$ metadataFactory = self ::getContainer ()->get ('ux.live_component.metadata_factory ' );
77
78
\assert ($ metadataFactory instanceof LiveComponentMetadataFactory);
78
79
$ testCase = $ testBuilder ->getTest ($ metadataFactory );
79
-
80
- $ componentAttributesFactory = self ::getContainer ()->get ('ux.twig_component.component_attributes_factory ' );
81
- \assert ($ componentAttributesFactory instanceof ComponentAttributesFactory );
80
+
81
+ $ twig = self ::getContainer ()->get ('twig ' );
82
+ \assert ($ twig instanceof Environment );
82
83
83
84
// keep a copy of the original, empty component object for hydration later
84
85
$ originalComponentWithData = clone $ testCase ->component ;
@@ -94,7 +95,7 @@ private function executeHydrationTestCase(callable $testFactory, ?int $minPhpVer
94
95
95
96
$ dehydratedProps = $ this ->hydrator ()->dehydrate (
96
97
$ originalComponentWithData ,
97
- $ componentAttributesFactory -> create ([] ), // not worried about testing these here
98
+ new ComponentAttributes ([], $ twig -> getRuntime (EscaperRuntime::class) ), // not worried about testing these here
98
99
$ liveMetadata ,
99
100
);
100
101
@@ -136,7 +137,7 @@ private function executeHydrationTestCase(callable $testFactory, ?int $minPhpVer
136
137
137
138
$ dehydratedProps2 = $ this ->hydrator ()->dehydrate (
138
139
$ componentAfterHydration ,
139
- $ componentAttributesFactory -> create ( ),
140
+ new ComponentAttributes ([], $ twig -> getRuntime (EscaperRuntime::class) ),
140
141
$ liveMetadata ,
141
142
);
142
143
$ this ->hydrator ()->hydrate (
@@ -1824,14 +1825,14 @@ public static function falseyValueProvider(): iterable
1824
1825
yield ['nullableBool ' , '' , null ];
1825
1826
yield 'fooey-o-booey-todo ' => ['nullableBool ' , ' ' , null ];
1826
1827
}
1827
-
1828
+
1828
1829
private function createComponentAttributes (array $ attributes = []): ComponentAttributes
1829
1830
{
1830
- $ factory = self ::getContainer ()->get ('ux.twig_component.component_attributes_factory ' );
1831
- \assert ($ factory instanceof ComponentAttributesFactory );
1832
-
1833
- return $ factory -> create ( $ attributes );
1834
- }
1831
+ $ twig = self ::getContainer ()->get ('twig ' );
1832
+ \assert ($ twig instanceof Environment );
1833
+
1834
+ return new ComponentAttributes ( $ attributes , $ twig -> getRuntime (EscaperRuntime::class) );
1835
+ }
1835
1836
1836
1837
private function createLiveMetadata (object $ component ): LiveComponentMetadata
1837
1838
{
0 commit comments