@@ -25,11 +25,12 @@ class RequestPropsExtractorTest extends KernelTestCase
25
25
/**
26
26
* @dataProvider getQueryStringTests
27
27
*/
28
- public function testExtract (string $ queryString , array $ expected)
28
+ public function testExtractFromQueryString (string $ queryString , array $ expected, array $ attributes = []): void
29
29
{
30
30
$ extractor = new RequestPropsExtractor ($ this ->hydrator ());
31
31
32
32
$ request = Request::create ('/ ' .!empty ($ queryString ) ? '? ' .$ queryString : '' );
33
+ $ request ->attributes ->add ($ attributes );
33
34
34
35
/** @var LiveComponentMetadataFactory $metadataFactory */
35
36
$ metadataFactory = self ::getContainer ()->get ('ux.live_component.metadata_factory ' );
@@ -65,6 +66,10 @@ public function getQueryStringTests(): iterable
65
66
'invalid array value ' => ['arrayProp=foo ' , []],
66
67
'invalid object value ' => ['objectProp=foo ' , []],
67
68
'aliased prop ' => ['q=foo ' , ['boundPropWithAlias ' => 'foo ' ]],
69
+ 'attribute prop ' => ['' , ['stringProp ' => 'foo ' ], ['stringProp ' => 'foo ' ]],
70
+ 'attribute aliased prop ' => ['' , ['boundPropWithAlias ' => 'foo ' ], ['q ' => 'foo ' ]],
71
+ 'attribute not bound prop ' => ['' , [], ['unboundProp ' => 'foo ' ]],
72
+ 'query priority ' => ['stringProp=foo ' , ['stringProp ' => 'foo ' ], ['stringProp ' => 'bar ' ]],
68
73
];
69
74
}
70
75
}
0 commit comments