File tree Expand file tree Collapse file tree 2 files changed +44
-2
lines changed
src/Bridge/Symfony/Bundle/DependencyInjection
tests/Bridge/Symfony/Bundle/DependencyInjection Expand file tree Collapse file tree 2 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -42,13 +42,19 @@ public function getConfigTreeBuilder()
42
42
->children ()
43
43
->scalarNode ('title ' )
44
44
->info ('The title of the API. ' )
45
- ->cannotBeEmpty ()
46
45
->defaultValue ('' )
46
+ ->beforeNormalization ()
47
+ ->ifNull ()
48
+ ->then (function ($ v ) { return '' ; })
49
+ ->end ()
47
50
->end ()
48
51
->scalarNode ('description ' )
49
52
->info ('The description of the API. ' )
50
- ->cannotBeEmpty ()
51
53
->defaultValue ('' )
54
+ ->beforeNormalization ()
55
+ ->ifNull ()
56
+ ->then (function ($ v ) { return '' ; })
57
+ ->end ()
52
58
->end ()
53
59
->scalarNode ('version ' )
54
60
->info ('The version of the API. ' )
Original file line number Diff line number Diff line change @@ -234,4 +234,40 @@ public function testApiKeysConfig()
234
234
$ this ->assertTrue (isset ($ config ['swagger ' ]['api_keys ' ]));
235
235
$ this ->assertSame ($ exampleConfig , $ config ['swagger ' ]['api_keys ' ][0 ]);
236
236
}
237
+
238
+ /**
239
+ * Test config for empty title and description.
240
+ */
241
+ public function testEmptyTitleDescriptionConfig ()
242
+ {
243
+ $ testConfig = [
244
+ 'title ' => '' ,
245
+ 'description ' => '' ,
246
+ ];
247
+
248
+ $ config = $ this ->processor ->processConfiguration ($ this ->configuration , [
249
+ 'api_platform ' => $ testConfig ,
250
+ ]);
251
+
252
+ $ this ->assertSame ($ config ['title ' ], '' );
253
+ $ this ->assertSame ($ config ['description ' ], '' );
254
+ }
255
+
256
+ /**
257
+ * Test config for null title and description.
258
+ */
259
+ public function testNullTitleDescriptionConfig ()
260
+ {
261
+ $ testConfig = [
262
+ 'title ' => null ,
263
+ 'description ' => null ,
264
+ ];
265
+
266
+ $ config = $ this ->processor ->processConfiguration ($ this ->configuration , [
267
+ 'api_platform ' => $ testConfig ,
268
+ ]);
269
+
270
+ $ this ->assertSame ($ config ['title ' ], '' );
271
+ $ this ->assertSame ($ config ['description ' ], '' );
272
+ }
237
273
}
You can’t perform that action at this time.
0 commit comments