Skip to content

Commit 156b3c2

Browse files
#7720: fix integration test
1 parent 2c15517 commit 156b3c2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/MultiStoreConfigurableViewOnProductPageTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Magento\Store\Model\StoreManagerInterface;
1818
use Magento\TestFramework\Helper\Bootstrap;
1919
use Magento\TestFramework\Store\ExecuteInStoreContext;
20+
use Magento\Store\Api\StoreRepositoryInterface;
2021
use PHPUnit\Framework\TestCase;
2122

2223
/**
@@ -47,6 +48,9 @@ class MultiStoreConfigurableViewOnProductPageTest extends TestCase
4748
/** @var ExecuteInStoreContext */
4849
private $executeInStoreContext;
4950

51+
/** @var StoreRepositoryInterface */
52+
private $storeRepository;
53+
5054
/**
5155
* @inheritdoc
5256
*/
@@ -62,6 +66,7 @@ protected function setUp()
6266
$this->serializer = $this->objectManager->get(SerializerInterface::class);
6367
$this->productResource = $this->objectManager->get(ProductResource::class);
6468
$this->executeInStoreContext = $this->objectManager->get(ExecuteInStoreContext::class);
69+
$this->storeRepository = $this->objectManager->get(StoreRepositoryInterface::class);
6570
}
6671

6772
/**
@@ -182,9 +187,11 @@ public function assertProductConfig($expectedProducts): void
182187
*/
183188
private function prepareConfigurableProduct(string $sku, string $storeCode): void
184189
{
190+
$storeId = $this->storeRepository->get($storeCode)->getId();
185191
$product = $this->productRepository->get($sku, false, null, true);
186192
$productToUpdate = $product->getTypeInstance()->getUsedProductCollection($product)
187-
->setPageSize(1)->getFirstItem();
193+
->addStoreFilter($storeId)->setPageSize(1)->getFirstItem();
194+
188195
$this->assertNotEmpty($productToUpdate->getData(), 'Configurable product does not have a child');
189196
$this->executeInStoreContext->execute($storeCode, [$this, 'setProductDisabled'], $productToUpdate);
190197
}

0 commit comments

Comments
 (0)