1515use Symfony \UX \LiveComponent \Attribute \LiveProp ;
1616use Symfony \UX \LiveComponent \Metadata \LiveComponentMetadata ;
1717use Symfony \UX \LiveComponent \Metadata \LivePropMetadata ;
18+ use Symfony \UX \LiveComponent \Metadata \UrlMapping ;
1819use Symfony \UX \TwigComponent \ComponentMetadata ;
1920
2021class LiveComponentMetadataTest extends TestCase
@@ -37,4 +38,19 @@ public function testGetOnlyPropsThatAcceptUpdatesFromParent()
3738 $ actual = $ liveComponentMetadata ->getOnlyPropsThatAcceptUpdatesFromParent ($ inputProps );
3839 $ this ->assertEquals ($ expected , $ actual );
3940 }
41+
42+ public function testGetAllUrlMappings (): void
43+ {
44+ $ aliasUrlMapping = new UrlMapping ('alias ' );
45+ $ propMetadas = [
46+ new LivePropMetadata ('noUrlMapping ' , new LiveProp (), null , false , false , null ),
47+ new LivePropMetadata ('basicUrlMapping ' , new LiveProp (url: true ), null , false , false , null ),
48+ new LivePropMetadata ('aliasUrlMapping ' , new LiveProp (url: $ aliasUrlMapping ), null , false , false , null ),
49+ ];
50+ $ liveComponentMetadata = new LiveComponentMetadata (new ComponentMetadata ([]), $ propMetadas );
51+ $ urlMappings = $ liveComponentMetadata ->getAllUrlMappings ();
52+ $ this ->assertCount (2 , $ urlMappings );
53+ $ this ->assertInstanceOf (UrlMapping::class, $ urlMappings ['basicUrlMapping ' ]);
54+ $ this ->assertEquals ($ aliasUrlMapping , $ urlMappings ['aliasUrlMapping ' ]);
55+ }
4056}
0 commit comments