1717use Magento \Store \Model \StoreManagerInterface ;
1818use Magento \TestFramework \Helper \Bootstrap ;
1919use Magento \TestFramework \Store \ExecuteInStoreContext ;
20- use Magento \Store \Api \StoreRepositoryInterface ;
2120use PHPUnit \Framework \TestCase ;
2221
2322/**
@@ -48,9 +47,6 @@ class MultiStoreConfigurableViewOnProductPageTest extends TestCase
4847 /** @var ExecuteInStoreContext */
4948 private $ executeInStoreContext ;
5049
51- /** @var StoreRepositoryInterface */
52- private $ storeRepository ;
53-
5450 /**
5551 * @inheritdoc
5652 */
@@ -66,7 +62,6 @@ protected function setUp()
6662 $ this ->serializer = $ this ->objectManager ->get (SerializerInterface::class);
6763 $ this ->productResource = $ this ->objectManager ->get (ProductResource::class);
6864 $ this ->executeInStoreContext = $ this ->objectManager ->get (ExecuteInStoreContext::class);
69- $ this ->storeRepository = $ this ->objectManager ->get (StoreRepositoryInterface::class);
7065 }
7166
7267 /**
@@ -187,10 +182,10 @@ public function assertProductConfig($expectedProducts): void
187182 */
188183 private function prepareConfigurableProduct (string $ sku , string $ storeCode ): void
189184 {
190- $ storeId = $ this ->storeRepository -> get ($ storeCode)-> getId ( );
185+ $ store = $ this ->storeManager -> getStore ($ storeCode );
191186 $ product = $ this ->productRepository ->get ($ sku , false , null , true );
192187 $ productToUpdate = $ product ->getTypeInstance ()->getUsedProductCollection ($ product )
193- ->addStoreFilter ($ storeId )->setPageSize (1 )->getFirstItem ();
188+ ->addStoreFilter ($ store )->setPageSize (1 )->getFirstItem ();
194189
195190 $ this ->assertNotEmpty ($ productToUpdate ->getData (), 'Configurable product does not have a child ' );
196191 $ this ->executeInStoreContext ->execute ($ storeCode , [$ this , 'setProductDisabled ' ], $ productToUpdate );
0 commit comments