Ejemplo n.º 1
0
 public function testIsSalableNoManageStock()
 {
     $option1 = $this->getRequiredOptionMock(10, 10);
     $option2 = $this->getRequiredOptionMock(20, 10);
     $stockItem = $this->getStockItem(true);
     $this->stockRegistry->method('getStockItem')->willReturn($stockItem);
     $this->stockState->expects($this->at(0))->method('getStockQty')->with(10)->willReturn(10);
     $this->stockState->expects($this->at(1))->method('getStockQty')->with(20)->willReturn(10);
     $optionCollectionMock = $this->getOptionCollectionMock([$option1, $option2]);
     $selectionCollectionMock = $this->getSelectionCollectionMock([$option1, $option2]);
     $product = new \Magento\Framework\Object(['is_salable' => true, '_cache_instance_options_collection' => $optionCollectionMock, 'status' => \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED, '_cache_instance_selections_collection10_20' => $selectionCollectionMock]);
     $this->assertTrue($this->model->isSalable($product));
 }