@@ -114,46 +114,44 @@ public function testBuild(): void
114114 ->method ('getAttribute ' )
115115 ->with (Product::ENTITY , 'price ' )
116116 ->willReturn ($ attributeInterface );
117- $ sortOrderList = ['relevance ' ,'_id ' ];
118- $ sortIncrementIndex = 0 ;
119- foreach ($ sortOrderList as $ sortList ) {
120- $ this ->sortOrderBuilder ->expects ($ this ->at ($ sortIncrementIndex ++))
121- ->method ('setField ' )
122- ->with ($ sortList )
123- ->willReturnSelf ();
124- $ this ->sortOrderBuilder ->expects ($ this ->at ($ sortIncrementIndex ++))
125- ->method ('setDirection ' )
126- ->with ('DESC ' )
127- ->willReturnSelf ();
128- $ this ->sortOrderBuilder ->expects ($ this ->at ($ sortIncrementIndex ++))
129- ->method ('create ' )
130- ->willReturn ([]);
131- }
132- $ filterOrderList = [1 =>'search_term ' , 2 =>'visibility ' ];
133- $ filterIncrementIndex = 0 ;
134- foreach ($ filterOrderList as $ index => $ filterList ) {
135- $ this ->filterBuilder ->expects ($ this ->at ($ filterIncrementIndex ++))
136- ->method ('setField ' )
137- ->with ($ filterList )
138- ->willReturnSelf ();
139- $ this ->filterBuilder ->expects ($ this ->at ($ filterIncrementIndex ++))
140- ->method ('setValue ' )
141- ->with ('' )
142- ->willReturnSelf ();
143- if ($ index ==2 ) {
144- $ this ->filterBuilder ->expects ($ this ->at ($ filterIncrementIndex ++))
145- ->method ('setConditionType ' )
146- ->with ('in ' )
147- ->willReturnSelf ();
148- } else {
149- $ this ->filterBuilder ->expects ($ this ->at ($ filterIncrementIndex ++))
150- ->method ('setConditionType ' )
151- ->with ('' )
152- ->willReturnSelf ();
153- }
154-
155- $ this ->filterBuilder ->expects ($ this ->at ($ filterIncrementIndex ++))->method ('create ' )->willReturn ($ filter );
156- }
117+ $ sortOrderList = ['relevance ' , '_id ' ];
118+
119+ $ this ->sortOrderBuilder ->expects ($ this ->exactly (2 ))
120+ ->method ('setField ' )
121+ ->withConsecutive ([$ sortOrderList [0 ]], [$ sortOrderList [1 ]])
122+ ->willReturnSelf ();
123+
124+ $ this ->sortOrderBuilder ->expects ($ this ->exactly (2 ))
125+ ->method ('setDirection ' )
126+ ->with ('DESC ' )
127+ ->willReturnSelf ();
128+
129+ $ this ->sortOrderBuilder ->expects ($ this ->exactly (2 ))
130+ ->method ('create ' )
131+ ->willReturn ([]);
132+
133+ $ filterOrderList = ['search_term ' , 'visibility ' ];
134+
135+ $ this ->filterBuilder ->expects ($ this ->exactly (2 ))
136+ ->method ('setField ' )
137+ ->withConsecutive ([$ filterOrderList [0 ]], [$ filterOrderList [1 ]])
138+ ->willReturnSelf ();
139+
140+ $ this ->filterBuilder ->expects ($ this ->exactly (2 ))
141+ ->method ('setValue ' )
142+ ->with ('' )
143+ ->willReturnSelf ();
144+
145+ $ this ->filterBuilder ->expects ($ this ->exactly (2 ))
146+ ->method ('setConditionType ' )
147+ ->withConsecutive (['' ], ['in ' ])
148+ ->willReturnSelf ();
149+
150+ $ this ->filterBuilder
151+ ->expects ($ this ->exactly (2 ))
152+ ->method ('create ' )
153+ ->willReturn ($ filter );
154+
157155 $ this ->filterGroupBuilder ->expects ($ this ->any ())
158156 ->method ('addFilter ' )
159157 ->with ($ filter )
0 commit comments