15
15
use Symfony \UX \LiveComponent \Attribute \LiveProp ;
16
16
use Symfony \UX \LiveComponent \Metadata \LiveComponentMetadata ;
17
17
use Symfony \UX \LiveComponent \Metadata \LivePropMetadata ;
18
+ use Symfony \UX \LiveComponent \Metadata \UrlMapping ;
18
19
use Symfony \UX \TwigComponent \ComponentMetadata ;
19
20
20
21
class LiveComponentMetadataTest extends TestCase
@@ -37,4 +38,19 @@ public function testGetOnlyPropsThatAcceptUpdatesFromParent()
37
38
$ actual = $ liveComponentMetadata ->getOnlyPropsThatAcceptUpdatesFromParent ($ inputProps );
38
39
$ this ->assertEquals ($ expected , $ actual );
39
40
}
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
+ }
40
56
}
0 commit comments