17
17
use Magento \Store \Model \StoreManagerInterface ;
18
18
use Magento \TestFramework \Helper \Bootstrap ;
19
19
use Magento \TestFramework \Store \ExecuteInStoreContext ;
20
- use Magento \Store \Api \StoreRepositoryInterface ;
21
20
use PHPUnit \Framework \TestCase ;
22
21
23
22
/**
@@ -48,9 +47,6 @@ class MultiStoreConfigurableViewOnProductPageTest extends TestCase
48
47
/** @var ExecuteInStoreContext */
49
48
private $ executeInStoreContext ;
50
49
51
- /** @var StoreRepositoryInterface */
52
- private $ storeRepository ;
53
-
54
50
/**
55
51
* @inheritdoc
56
52
*/
@@ -66,7 +62,6 @@ protected function setUp()
66
62
$ this ->serializer = $ this ->objectManager ->get (SerializerInterface::class);
67
63
$ this ->productResource = $ this ->objectManager ->get (ProductResource::class);
68
64
$ this ->executeInStoreContext = $ this ->objectManager ->get (ExecuteInStoreContext::class);
69
- $ this ->storeRepository = $ this ->objectManager ->get (StoreRepositoryInterface::class);
70
65
}
71
66
72
67
/**
@@ -187,10 +182,10 @@ public function assertProductConfig($expectedProducts): void
187
182
*/
188
183
private function prepareConfigurableProduct (string $ sku , string $ storeCode ): void
189
184
{
190
- $ storeId = $ this ->storeRepository -> get ($ storeCode)-> getId ( );
185
+ $ store = $ this ->storeManager -> getStore ($ storeCode );
191
186
$ product = $ this ->productRepository ->get ($ sku , false , null , true );
192
187
$ productToUpdate = $ product ->getTypeInstance ()->getUsedProductCollection ($ product )
193
- ->addStoreFilter ($ storeId )->setPageSize (1 )->getFirstItem ();
188
+ ->addStoreFilter ($ store )->setPageSize (1 )->getFirstItem ();
194
189
195
190
$ this ->assertNotEmpty ($ productToUpdate ->getData (), 'Configurable product does not have a child ' );
196
191
$ this ->executeInStoreContext ->execute ($ storeCode , [$ this , 'setProductDisabled ' ], $ productToUpdate );
0 commit comments