@@ -381,8 +381,10 @@ public function testSearchWithFilterWithPageSizeEqualTotalCount()
381
381
}
382
382
QUERY ;
383
383
$ this ->expectException (\Exception::class);
384
- $ this ->expectExceptionMessage ('GraphQL response contains errors: currentPage value 2 specified is greater ' .
385
- 'than the 1 page(s) available ' );
384
+ $ this ->expectExceptionMessage (
385
+ 'GraphQL response contains errors: currentPage value 2 specified is greater ' .
386
+ 'than the 1 page(s) available '
387
+ );
386
388
$ this ->graphQlQuery ($ query );
387
389
}
388
390
@@ -1043,8 +1045,10 @@ public function testQueryPageOutOfBoundException()
1043
1045
QUERY ;
1044
1046
1045
1047
$ this ->expectException (\Exception::class);
1046
- $ this ->expectExceptionMessage ('GraphQL response contains errors: currentPage value 2 specified is greater ' .
1047
- 'than the 1 page(s) available. ' );
1048
+ $ this ->expectExceptionMessage (
1049
+ 'GraphQL response contains errors: currentPage value 2 specified is greater ' .
1050
+ 'than the 1 page(s) available. '
1051
+ );
1048
1052
$ this ->graphQlQuery ($ query );
1049
1053
}
1050
1054
@@ -1075,8 +1079,10 @@ public function testQueryWithNoSearchOrFilterArgumentException()
1075
1079
QUERY ;
1076
1080
1077
1081
$ this ->expectException (\Exception::class);
1078
- $ this ->expectExceptionMessage ('GraphQL response contains errors: \'search \' or \'filter \' input argument is ' .
1079
- 'required. ' );
1082
+ $ this ->expectExceptionMessage (
1083
+ 'GraphQL response contains errors: \'search \' or \'filter \' input argument is ' .
1084
+ 'required. '
1085
+ );
1080
1086
$ this ->graphQlQuery ($ query );
1081
1087
}
1082
1088
@@ -1162,6 +1168,37 @@ public function testInvalidPageNumbers()
1162
1168
$ this ->graphQlQuery ($ query );
1163
1169
}
1164
1170
1171
+ /**
1172
+ * Verify that invalid page size returns an error
1173
+ *
1174
+ * @magentoApiDataFixture Magento/Catalog/_files/products_with_layered_navigation_attribute.php
1175
+ * @expectedException \Exception
1176
+ * @expectedExceptionMessage pageSize value must be greater than 0
1177
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
1178
+ */
1179
+ public function testInvalidPageSize ()
1180
+ {
1181
+ $ query = <<<QUERY
1182
+ {
1183
+ products (
1184
+ filter: {
1185
+ sku: {
1186
+ like:"simple%"
1187
+ }
1188
+ }
1189
+ pageSize: 0
1190
+ currentPage: 1
1191
+ ) {
1192
+ items {
1193
+ sku
1194
+ }
1195
+ }
1196
+ }
1197
+ QUERY ;
1198
+
1199
+ $ this ->graphQlQuery ($ query );
1200
+ }
1201
+
1165
1202
/**
1166
1203
* Asserts the different fields of items returned after search query is executed
1167
1204
*
@@ -1171,7 +1208,7 @@ public function testInvalidPageNumbers()
1171
1208
private function assertProductItems (array $ filteredProducts , array $ actualResponse )
1172
1209
{
1173
1210
$ productItemsInResponse = array_map (null , $ actualResponse ['products ' ]['items ' ], $ filteredProducts );
1174
-
1211
+ // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
1175
1212
for ($ itemIndex = 0 ; $ itemIndex < count ($ filteredProducts ); $ itemIndex ++) {
1176
1213
$ this ->assertNotEmpty ($ productItemsInResponse [$ itemIndex ]);
1177
1214
$ this ->assertResponseFields (
0 commit comments