Skip to content

Commit 6d6b7ef

Browse files
Pandoraaaalanpoulain
authored andcommitted
Add Swagger DocumentationNormalizer test for array collection filters (#2241)
1 parent 1484962 commit 6d6b7ef

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

tests/Swagger/Serializer/DocumentationNormalizerTest.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,14 +1229,21 @@ public function testFilters()
12291229
'required' => false,
12301230
'strategy' => 'partial',
12311231
]]),
1232+
'f3' => new DummyFilter(['toto' => [
1233+
'property' => 'name',
1234+
'type' => 'array',
1235+
'is_collection' => true,
1236+
'required' => true,
1237+
'strategy' => 'exact',
1238+
]]),
12321239
];
12331240

12341241
foreach ($filters as $filterId => $filter) {
12351242
$filterLocatorProphecy->has($filterId)->willReturn(true)->shouldBeCalled();
12361243
$filterLocatorProphecy->get($filterId)->willReturn($filter)->shouldBeCalled();
12371244
}
12381245

1239-
$filterLocatorProphecy->has('f3')->willReturn(false)->shouldBeCalled();
1246+
$filterLocatorProphecy->has('f4')->willReturn(false)->shouldBeCalled();
12401247

12411248
$this->normalizeWithFilters($filterLocatorProphecy->reveal());
12421249
}
@@ -1261,6 +1268,13 @@ public function testFiltersWithDeprecatedFilterCollection()
12611268
'required' => false,
12621269
'strategy' => 'partial',
12631270
]]),
1271+
'f3' => new DummyFilter(['toto' => [
1272+
'property' => 'name',
1273+
'type' => 'array',
1274+
'is_collection' => true,
1275+
'required' => true,
1276+
'strategy' => 'exact',
1277+
]]),
12641278
]));
12651279
}
12661280

@@ -1651,7 +1665,7 @@ private function normalizeWithFilters($filterLocator)
16511665
'This is a dummy.',
16521666
null,
16531667
[],
1654-
['get' => ['method' => 'GET', 'filters' => ['f1', 'f2', 'f3']]],
1668+
['get' => ['method' => 'GET', 'filters' => ['f1', 'f2', 'f3', 'f4']]],
16551669
[]
16561670
);
16571671
$resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
@@ -1716,6 +1730,16 @@ private function normalizeWithFilters($filterLocator)
17161730
'required' => false,
17171731
'type' => 'integer',
17181732
],
1733+
[
1734+
'name' => 'toto',
1735+
'in' => 'query',
1736+
'required' => true,
1737+
'type' => 'array',
1738+
'items' => [
1739+
'type' => 'string',
1740+
],
1741+
'collectionFormat' => 'csv',
1742+
],
17191743
[
17201744
'name' => 'page',
17211745
'in' => 'query',

0 commit comments

Comments
 (0)