@@ -218,7 +218,7 @@ public function testFilterProductsByDropDownCustomAttribute()
218
218
products(filter:{
219
219
$ attributeCode: {eq: " {$ optionValue }"}
220
220
}
221
- sort:{relevance:DESC}
221
+
222
222
pageSize: 3
223
223
currentPage: 1
224
224
)
@@ -1493,12 +1493,12 @@ public function testSearchAndSortByRelevance()
1493
1493
}
1494
1494
QUERY ;
1495
1495
$ response = $ this ->graphQlQuery ($ query );
1496
- $ this ->assertEquals (4 , $ response ['products ' ]['total_count ' ]);
1496
+ $ this ->assertEquals (3 , $ response ['products ' ]['total_count ' ]);
1497
1497
$ this ->assertNotEmpty ($ response ['products ' ]['filters ' ], 'Filters should have the Category layer ' );
1498
1498
$ this ->assertEquals ('Colorful Category ' , $ response ['products ' ]['filters ' ][0 ]['filter_items ' ][0 ]['label ' ]);
1499
- $ productsInResponse = ['ocean blue Shoes ' , ' Blue briefs ' ,'Navy Striped Shoes ' ,'Grey shorts ' ];
1500
- // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
1501
- for ($ i = 0 ; $ i < count ( $ response [ ' products ' ][ ' items ' ]) ; $ i ++) {
1499
+ $ productsInResponse = ['Blue briefs ' ,'Navy Striped Shoes ' ,'Grey shorts ' ];
1500
+ $ count = count ( $ response [ ' products ' ][ ' items ' ]);
1501
+ for ($ i = 0 ; $ i < $ count ; $ i ++) {
1502
1502
$ this ->assertEquals ($ productsInResponse [$ i ], $ response ['products ' ]['items ' ][$ i ]['name ' ]);
1503
1503
}
1504
1504
$ this ->assertCount (2 , $ response ['products ' ]['aggregations ' ]);
@@ -1634,11 +1634,10 @@ public function testProductBasicFullTextSearchQuery()
1634
1634
$ prod1 = $ productRepository ->get ('blue_briefs ' );
1635
1635
$ prod2 = $ productRepository ->get ('grey_shorts ' );
1636
1636
$ prod3 = $ productRepository ->get ('navy-striped-shoes ' );
1637
- $ prod4 = $ productRepository ->get ('ocean-blue-shoes ' );
1638
1637
$ response = $ this ->graphQlQuery ($ query );
1639
- $ this ->assertEquals (4 , $ response ['products ' ]['total_count ' ]);
1638
+ $ this ->assertEquals (3 , $ response ['products ' ]['total_count ' ]);
1640
1639
1641
- $ filteredProducts = [$ prod1 , $ prod2 , $ prod3, $ prod4 ];
1640
+ $ filteredProducts = [$ prod1 , $ prod2 , $ prod3 ];
1642
1641
$ productItemsInResponse = array_map (null , $ response ['products ' ]['items ' ], $ filteredProducts );
1643
1642
foreach ($ productItemsInResponse as $ itemIndex => $ itemArray ) {
1644
1643
$ this ->assertNotEmpty ($ itemArray );
@@ -1753,8 +1752,8 @@ public function testFilterWithinASpecificPriceRangeSortedByPriceDESC()
1753
1752
//verify that by default Price and category are the only layers available
1754
1753
$ filterNames = ['Category ' , 'Price ' ];
1755
1754
$ this ->assertCount (2 , $ response ['products ' ]['filters ' ], 'Filter count does not match ' );
1756
- // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
1757
- for ($ i = 0 ; $ i < count ( $ response [ ' products ' ][ ' filters ' ]) ; $ i ++) {
1755
+ $ productCount = count ( $ response [ ' products ' ][ ' filters ' ]);
1756
+ for ($ i = 0 ; $ i < $ productCount ; $ i ++) {
1758
1757
$ this ->assertEquals ($ filterNames [$ i ], $ response ['products ' ]['filters ' ][$ i ]['name ' ]);
1759
1758
}
1760
1759
}
@@ -2031,8 +2030,8 @@ public function testInvalidPageSize()
2031
2030
private function assertProductItems (array $ filteredProducts , array $ actualResponse )
2032
2031
{
2033
2032
$ productItemsInResponse = array_map (null , $ actualResponse ['products ' ]['items ' ], $ filteredProducts );
2034
- // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
2035
- for ($ itemIndex = 0 ; $ itemIndex < count ( $ filteredProducts ) ; $ itemIndex ++) {
2033
+ $ count = count ( $ filteredProducts );
2034
+ for ($ itemIndex = 0 ; $ itemIndex < $ count ; $ itemIndex ++) {
2036
2035
$ this ->assertNotEmpty ($ productItemsInResponse [$ itemIndex ]);
2037
2036
$ this ->assertResponseFields (
2038
2037
$ productItemsInResponse [$ itemIndex ][0 ],
0 commit comments