@@ -25,11 +25,12 @@ class RequestPropsExtractorTest extends KernelTestCase
2525 /**
2626 * @dataProvider getQueryStringTests
2727 */
28- public function testExtract (string $ queryString , array $ expected)
28+ public function testExtractFromQueryString (string $ queryString , array $ expected, array $ attributes = []): void
2929 {
3030 $ extractor = new RequestPropsExtractor ($ this ->hydrator ());
3131
3232 $ request = Request::create ('/ ' .!empty ($ queryString ) ? '? ' .$ queryString : '' );
33+ $ request ->attributes ->add ($ attributes );
3334
3435 /** @var LiveComponentMetadataFactory $metadataFactory */
3536 $ metadataFactory = self ::getContainer ()->get ('ux.live_component.metadata_factory ' );
@@ -65,6 +66,10 @@ public function getQueryStringTests(): iterable
6566 'invalid array value ' => ['arrayProp=foo ' , []],
6667 'invalid object value ' => ['objectProp=foo ' , []],
6768 '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 ' ]],
6873 ];
6974 }
7075}
0 commit comments