|
15 | 15 | use Magento\Bundle\Pricing\Price\BundleSelectionFactory;
|
16 | 16 | use Magento\Catalog\Helper\Data as CatalogData;
|
17 | 17 | use Magento\Catalog\Model\Product;
|
| 18 | +use Magento\Framework\Data\Collection\EntityFactoryInterface; |
18 | 19 | use Magento\Framework\DataObject;
|
19 | 20 | use Magento\Store\Api\Data\StoreInterface;
|
20 | 21 | use Magento\Store\Api\Data\WebsiteInterface;
|
@@ -177,7 +178,48 @@ public function testGetPriceList(): void
|
177 | 178 | $this->selectionCollection->expects($this->once())
|
178 | 179 | ->method('getIterator')
|
179 | 180 | ->willReturn(new \ArrayIterator([]));
|
| 181 | + $this->selectionCollection->expects($this->once()) |
| 182 | + ->method('setFlag') |
| 183 | + ->with('has_stock_status_filter', true); |
180 | 184 |
|
181 | 185 | $this->model->getPriceList($this->product, false, false);
|
182 | 186 | }
|
| 187 | + |
| 188 | + public function testGetPriceListWithSearchMin(): void |
| 189 | + { |
| 190 | + $option = $this->createMock(Option::class); |
| 191 | + $option->expects($this->once())->method('getRequired') |
| 192 | + ->willReturn(true); |
| 193 | + $this->optionsCollection->expects($this->any()) |
| 194 | + ->method('getIterator') |
| 195 | + ->willReturn(new \ArrayIterator([$option])); |
| 196 | + $this->typeInstance->expects($this->any()) |
| 197 | + ->method('getOptionsCollection') |
| 198 | + ->with($this->product) |
| 199 | + ->willReturn($this->optionsCollection); |
| 200 | + $this->product->expects($this->any()) |
| 201 | + ->method('getTypeInstance') |
| 202 | + ->willReturn($this->typeInstance); |
| 203 | + $this->selectionCollection->expects($this->once()) |
| 204 | + ->method('getFirstItem') |
| 205 | + ->willReturn($this->createMock(Product::class)); |
| 206 | + $this->typeInstance->expects($this->once()) |
| 207 | + ->method('getSelectionsCollection') |
| 208 | + ->willReturn($this->selectionCollection); |
| 209 | + $this->selectionCollection->expects($this->once()) |
| 210 | + ->method('setFlag') |
| 211 | + ->with('has_stock_status_filter', true); |
| 212 | + $this->selectionCollection->expects($this->once()) |
| 213 | + ->method('addQuantityFilter'); |
| 214 | + $this->product->expects($this->once())->method('isSalable')->willReturn(true); |
| 215 | + $this->optionsCollection->expects($this->once()) |
| 216 | + ->method('getSize') |
| 217 | + ->willReturn(1); |
| 218 | + $this->optionsCollection->expects($this->once()) |
| 219 | + ->method('addFilter') |
| 220 | + ->willReturn($this->optionsCollection); |
| 221 | + |
| 222 | + $this->model->getPriceList($this->product, true, false); |
| 223 | + } |
183 | 224 | }
|
| 225 | + |
0 commit comments