17
17
use Magento \Catalog \Model \Product \Attribute \Source \Status ;
18
18
use Magento \Catalog \Model \Product \Type ;
19
19
use Magento \Catalog \Model \Product \Visibility ;
20
- use Magento \CatalogInventory \Api \StockRegistryInterface ;
21
20
use Magento \CatalogInventory \Model \Stock ;
22
21
use Magento \Framework \ObjectManagerInterface ;
23
22
use Magento \Store \Api \StoreRepositoryInterface ;
@@ -148,8 +147,6 @@ public function testIsSalable(
148
147
bool $ isSalable
149
148
) {
150
149
$ productRepository = $ this ->objectManager ->get (ProductRepositoryInterface::class);
151
- /** @var \Magento\Catalog\Model\Product $bundle */
152
- $ bundle = $ productRepository ->get ('bundle-product ' );
153
150
154
151
$ child = $ productRepository ->get ('simple ' );
155
152
$ childStockItem = $ child ->getExtensionAttributes ()->getStockItem ();
@@ -161,15 +158,16 @@ public function testIsSalable(
161
158
$ childStockItem ->setBackorders ($ backorders );
162
159
$ productRepository ->save ($ child );
163
160
164
- foreach ($ bundle ->getExtensionAttributes ()->getBundleProductOptions () as $ productOption ) {
161
+ $ this ->model ->load (3 );
162
+ foreach ($ this ->model ->getExtensionAttributes ()->getBundleProductOptions () as $ productOption ) {
165
163
foreach ($ productOption ->getProductLinks () as $ productLink ) {
166
164
$ productLink ->setCanChangeQuantity (0 );
167
165
$ productLink ->setQty ($ selectionQty );
168
166
}
169
167
}
170
- $ productRepository ->save ($ bundle );
168
+ $ productRepository ->save ($ this -> model );
171
169
172
- $ this ->assertEquals ($ isSalable , $ bundle ->isSalable ());
170
+ $ this ->assertEquals ($ isSalable , $ this -> model ->isSalable ());
173
171
}
174
172
175
173
/**
0 commit comments