@@ -1296,4 +1296,54 @@ public function testInvoke(): void
1296
1296
$ this ->assertNotNull ($ diamondPutOperation );
1297
1297
$ this ->assertArrayNotHasKey ('403 ' , $ diamondPutResponses );
1298
1298
}
1299
+
1300
+ public function testGetExtensionPropertiesWithFalseValue (): void
1301
+ {
1302
+ $ resourceNameCollectionFactory = $ this ->createMock (ResourceNameCollectionFactoryInterface::class);
1303
+ $ resourceCollectionMetadataFactory = $ this ->createMock (ResourceMetadataCollectionFactoryInterface::class);
1304
+ $ propertyNameCollectionFactory = $ this ->createMock (PropertyNameCollectionFactoryInterface::class);
1305
+ $ propertyMetadataFactory = $ this ->createMock (PropertyMetadataFactoryInterface::class);
1306
+ $ definitionNameFactory = new DefinitionNameFactory ([]);
1307
+
1308
+ $ resourceCollectionMetadata = new ResourceMetadataCollection (Dummy::class, [(new ApiResource (operations: [
1309
+ (new Get ())->withOpenapi (true )->withShortName ('Dummy ' )->withName ('api_dummies_get_collection ' )->withRouteName ('api_dummies_get_collection ' ),
1310
+ ]))->withClass (Dummy::class)]);
1311
+
1312
+ $ resourceCollectionMetadataFactory
1313
+ ->method ('create ' )
1314
+ ->willReturnCallback (fn (string $ resourceClass ): ResourceMetadataCollection => match ($ resourceClass ) {
1315
+ default => new ResourceMetadataCollection ($ resourceClass , []),
1316
+ Dummy::class => $ resourceCollectionMetadata ,
1317
+ });
1318
+
1319
+ $ resourceNameCollectionFactory ->expects ($ this ->once ())
1320
+ ->method ('create ' )
1321
+ ->willReturn (new ResourceNameCollection ([Dummy::class]));
1322
+
1323
+ $ propertyNameCollectionFactory ->method ('create ' )->willReturn (new PropertyNameCollection ([]));
1324
+
1325
+ $ schemaFactory = new SchemaFactory (
1326
+ resourceMetadataFactory: $ resourceCollectionMetadataFactory ,
1327
+ propertyNameCollectionFactory: $ propertyNameCollectionFactory ,
1328
+ propertyMetadataFactory: $ propertyMetadataFactory ,
1329
+ nameConverter: new CamelCaseToSnakeCaseNameConverter (),
1330
+ definitionNameFactory: $ definitionNameFactory ,
1331
+ );
1332
+
1333
+ $ factory = new OpenApiFactory (
1334
+ $ resourceNameCollectionFactory ,
1335
+ $ resourceCollectionMetadataFactory ,
1336
+ $ propertyNameCollectionFactory ,
1337
+ $ propertyMetadataFactory ,
1338
+ $ schemaFactory ,
1339
+ null ,
1340
+ [],
1341
+ new Options ('Test API ' , 'This is a test API. ' , '1.2.3 ' ),
1342
+ new PaginationOptions (),
1343
+ null ,
1344
+ ['json ' => ['application/problem+json ' ]]
1345
+ );
1346
+
1347
+ $ openApi = $ factory ->__invoke ();
1348
+ }
1299
1349
}
0 commit comments