File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
dev/tests/api-functional/testsuite/Magento/GraphQl/Swatches Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,21 @@ private function getExpectedFiltersDataSet()
155
155
*/
156
156
private function assertFilters ($ response , $ expectedFilters , $ message = '' )
157
157
{
158
- $ this ->assertEquals ($ expectedFilters , $ response ['products ' ]['filters ' ], $ message );
158
+ $ this ->assertArrayHasKey ('filters ' , $ response ['products ' ], 'Product has filters ' );
159
+ $ this ->assertTrue (is_array (($ response ['products ' ]['filters ' ])), 'Product filters is array ' );
160
+ $ this ->assertTrue (count ($ response ['products ' ]['filters ' ]) > 0 , 'Product filters is not empty ' );
161
+ foreach ($ expectedFilters as $ expectedFilter ) {
162
+ $ found = false ;
163
+ foreach ($ response ['products ' ]['filters ' ] as $ responseFilter ) {
164
+ if ($ responseFilter ['name ' ] == $ expectedFilter ['name ' ]
165
+ && $ responseFilter ['request_var ' ] == $ expectedFilter ['request_var ' ]) {
166
+ $ found = true ;
167
+ break ;
168
+ }
169
+ }
170
+ if (!$ found ) {
171
+ $ this ->fail ($ message );
172
+ }
173
+ }
159
174
}
160
175
}
You can’t perform that action at this time.
0 commit comments