@@ -58,7 +58,6 @@ public function testFieldsTypeKeyIsResolvedToItsHostPropertyName(): void
5858 $ provider = $ this ->createProvider (authorShortName: 'SparseFieldsetIncludeAuthor ' );
5959
6060 $ parameter = (new QueryParameter (key: 'fields ' ))
61- ->withProperties (['title ' ])
6261 ->setValue (['SparseFieldsetIncludeAuthor ' => 'name ' ]);
6362
6463 $ result = $ provider ->provide ($ parameter , [], ['operation ' => $ operation ]);
@@ -80,7 +79,6 @@ public function testFieldsKeyMatchingThePropertyNameStillWorks(): void
8079 $ provider = $ this ->createProvider (authorShortName: 'Author ' );
8180
8281 $ parameter = (new QueryParameter (key: 'fields ' ))
83- ->withProperties (['title ' ])
8482 ->setValue (['author ' => 'name ' ]);
8583
8684 $ result = $ provider ->provide ($ parameter , [], ['operation ' => $ operation ]);
@@ -99,7 +97,6 @@ public function testFieldsAreDenormalizedWithTheNameConverter(): void
9997 $ provider = $ this ->createProvider (authorShortName: 'SparseFieldsetIncludeAuthor ' , nameConverter: new CamelCaseToSnakeCaseNameConverter ());
10098
10199 $ parameter = (new QueryParameter (key: 'fields ' ))
102- ->withProperties (['title ' , 'artistCredit ' ])
103100 ->setValue (['SparseFieldsetIncludeArticle ' => 'title,artist_credit,unknown_field ' ]);
104101
105102 $ result = $ provider ->provide ($ parameter , [], ['operation ' => $ operation ]);
@@ -119,7 +116,7 @@ private function createProvider(string $authorShortName, ?NameConverterInterface
119116 $ propertyNameCollectionFactory = $ this ->createStub (PropertyNameCollectionFactoryInterface::class);
120117 $ propertyNameCollectionFactory ->method ('create ' )->willReturnCallback (
121118 static fn (string $ class ): PropertyNameCollection => match ($ class ) {
122- $ articleClass => new PropertyNameCollection (['author ' ]),
119+ $ articleClass => new PropertyNameCollection (['author ' , ' title ' , ' artistCredit ' ]),
123120 $ authorClass => new PropertyNameCollection (['name ' ]),
124121 default => new PropertyNameCollection ([]),
125122 },
@@ -135,6 +132,7 @@ private function createProvider(string $authorShortName, ?NameConverterInterface
135132 static fn (string $ class , string $ property ): ApiProperty => match (true ) {
136133 $ articleClass === $ class && 'author ' === $ property => $ authorRelationProperty ,
137134 $ authorClass === $ class && 'name ' === $ property => $ authorNameProperty ,
135+ $ articleClass === $ class && \in_array ($ property , ['title ' , 'artistCredit ' ], true ) => $ authorNameProperty ,
138136 default => new ApiProperty (),
139137 },
140138 );
0 commit comments