File tree Expand file tree Collapse file tree 2 files changed +24
-15
lines changed
Model/ResourceModel/Selection
Test/Unit/Model/ResourceModel/Selection Expand file tree Collapse file tree 2 files changed +24
-15
lines changed Original file line number Diff line number Diff line change @@ -184,13 +184,15 @@ public function addQuantityFilter()
184
184
)
185
185
->where (
186
186
'( '
187
- . 'selection.selection_can_change_qty '
187
+ . 'selection.selection_can_change_qty > 0 '
188
188
. ' or '
189
189
. 'selection.selection_qty <= stock.qty '
190
190
. ' or '
191
191
.'stock_item.manage_stock = 0 '
192
- . ') and stock.stock_status = 1 '
193
- );
192
+ . ') '
193
+ )
194
+ ->where ('stock.stock_status = 1 ' );
195
+
194
196
return $ this ;
195
197
}
196
198
Original file line number Diff line number Diff line change @@ -115,7 +115,10 @@ public function testAddQuantityFilter()
115
115
$ itemTableName = 'cataloginventory_stock_item ' ;
116
116
$ this ->entity ->expects ($ this ->exactly (2 ))
117
117
->method ('getTable ' )
118
- ->willReturnOnConsecutiveCalls ($ itemTableName , $ statusTableName );
118
+ ->willReturnMap ([
119
+ ['cataloginventory_stock_item ' , $ itemTableName ],
120
+ ['cataloginventory_stock_status ' , $ statusTableName ],
121
+ ]);
119
122
$ this ->select ->expects ($ this ->exactly (2 ))
120
123
->method ('joinInner ' )
121
124
->withConsecutive (
@@ -131,18 +134,22 @@ public function testAddQuantityFilter()
131
134
]
132
135
)->willReturnSelf ();
133
136
$ this ->select
134
- ->expects ($ this ->once ( ))
137
+ ->expects ($ this ->exactly ( 2 ))
135
138
->method ('where ' )
136
- ->with (
137
- '( '
138
- . 'selection.selection_can_change_qty '
139
- . ' or '
140
- . 'selection.selection_qty <= stock.qty '
141
- . ' or '
142
- .'stock_item.manage_stock = 0 '
143
- . ') and stock.stock_status = 1 '
144
- )
145
- ->willReturnSelf ();
139
+ ->withConsecutive (
140
+ [
141
+ '( '
142
+ . 'selection.selection_can_change_qty > 0 '
143
+ . ' or '
144
+ . 'selection.selection_qty <= stock.qty '
145
+ . ' or '
146
+ .'stock_item.manage_stock = 0 '
147
+ . ') ' ,
148
+ ],
149
+ [
150
+ 'stock.stock_status = 1 ' ,
151
+ ]
152
+ )->willReturnSelf ();
146
153
147
154
$ this ->assertEquals ($ this ->model , $ this ->model ->addQuantityFilter ());
148
155
}
You can’t perform that action at this time.
0 commit comments