@@ -37,15 +37,9 @@ class ProductTest extends \PHPUnit\Framework\TestCase
37
37
*/
38
38
private $ objectManager ;
39
39
40
- /**
41
- * @var ProductRepositoryInterface
42
- */
43
- private $ productRepository ;
44
-
45
40
protected function setUp ()
46
41
{
47
42
$ this ->objectManager = Bootstrap::getObjectManager ();
48
- $ this ->productRepository = $ this ->objectManager ->get (ProductRepositoryInterface::class);
49
43
50
44
$ this ->model = $ this ->objectManager ->create (Product::class);
51
45
$ this ->model ->setTypeId (Type::TYPE_BUNDLE );
@@ -112,7 +106,9 @@ public function testIsComposite()
112
106
*/
113
107
public function testMultipleStores ()
114
108
{
115
- $ bundle = $ this ->productRepository ->get ('bundle-product ' );
109
+ /** @var ProductRepositoryInterface $productRepository */
110
+ $ productRepository = $ this ->objectManager ->get (ProductRepositoryInterface::class);
111
+ $ bundle = $ productRepository ->get ('bundle-product ' );
116
112
117
113
/** @var StoreRepositoryInterface $storeRepository */
118
114
$ storeRepository = $ this ->objectManager ->get (StoreRepositoryInterface::class);
@@ -126,7 +122,7 @@ public function testMultipleStores()
126
122
127
123
$ bundle ->setStoreId ($ store ->getId ())
128
124
->setCopyFromView (true );
129
- $ updatedBundle = $ this -> productRepository ->save ($ bundle );
125
+ $ updatedBundle = $ productRepository ->save ($ bundle );
130
126
131
127
self ::assertEquals ($ store ->getId (), $ updatedBundle ->getStoreId ());
132
128
}
@@ -151,10 +147,11 @@ public function testIsSalable(
151
147
int $ backorders ,
152
148
bool $ isSalable
153
149
) {
150
+ $ productRepository = $ this ->objectManager ->get (ProductRepositoryInterface::class);
154
151
/** @var \Magento\Catalog\Model\Product $bundle */
155
- $ bundle = $ this -> productRepository ->get ('bundle-product ' );
152
+ $ bundle = $ productRepository ->get ('bundle-product ' );
156
153
157
- $ child = $ this -> productRepository ->get ('simple ' );
154
+ $ child = $ productRepository ->get ('simple ' );
158
155
$ stockRegistry = $ this ->objectManager ->get (StockRegistryInterface::class);
159
156
$ childStockItem = $ stockRegistry ->getStockItem ($ child ->getId ());
160
157
$ childStockItem ->setQty ($ qty );
@@ -171,7 +168,6 @@ public function testIsSalable(
171
168
$ productLink ->setCanChangeQuantity (0 );
172
169
$ productLink ->setQty ($ selectionQty );
173
170
$ linkManagement ->saveChild ($ bundle ->getSku (), $ productLink );
174
-
175
171
}
176
172
}
177
173
0 commit comments