4343use Symfony \UX \LiveComponent \Tests \Fixtures \Enum \ZeroIntEnum ;
4444use Symfony \UX \LiveComponent \Tests \LiveComponentTestHelper ;
4545use Symfony \UX \TwigComponent \ComponentAttributes ;
46- use Symfony \UX \TwigComponent \ComponentAttributesFactory ;
4746use Symfony \UX \TwigComponent \ComponentMetadata ;
47+ use Twig \Environment ;
48+ use Twig \Runtime \EscaperRuntime ;
4849use Zenstruck \Foundry \Test \Factories ;
4950use Zenstruck \Foundry \Test \ResetDatabase ;
5051
@@ -76,9 +77,9 @@ private function executeHydrationTestCase(callable $testFactory, ?int $minPhpVer
7677 $ metadataFactory = self ::getContainer ()->get ('ux.live_component.metadata_factory ' );
7778 \assert ($ metadataFactory instanceof LiveComponentMetadataFactory);
7879 $ 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 );
8283
8384 // keep a copy of the original, empty component object for hydration later
8485 $ originalComponentWithData = clone $ testCase ->component ;
@@ -94,7 +95,7 @@ private function executeHydrationTestCase(callable $testFactory, ?int $minPhpVer
9495
9596 $ dehydratedProps = $ this ->hydrator ()->dehydrate (
9697 $ originalComponentWithData ,
97- $ componentAttributesFactory -> create ([] ), // not worried about testing these here
98+ new ComponentAttributes ([], $ twig -> getRuntime (EscaperRuntime::class) ), // not worried about testing these here
9899 $ liveMetadata ,
99100 );
100101
@@ -136,7 +137,7 @@ private function executeHydrationTestCase(callable $testFactory, ?int $minPhpVer
136137
137138 $ dehydratedProps2 = $ this ->hydrator ()->dehydrate (
138139 $ componentAfterHydration ,
139- $ componentAttributesFactory -> create ( ),
140+ new ComponentAttributes ([], $ twig -> getRuntime (EscaperRuntime::class) ),
140141 $ liveMetadata ,
141142 );
142143 $ this ->hydrator ()->hydrate (
@@ -1824,14 +1825,14 @@ public static function falseyValueProvider(): iterable
18241825 yield ['nullableBool ' , '' , null ];
18251826 yield 'fooey-o-booey-todo ' => ['nullableBool ' , ' ' , null ];
18261827 }
1827-
1828+
18281829 private function createComponentAttributes (array $ attributes = []): ComponentAttributes
18291830 {
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+ }
18351836
18361837 private function createLiveMetadata (object $ component ): LiveComponentMetadata
18371838 {
0 commit comments