Skip to content

Commit 7491d77

Browse files
committed
MC-39575: Create automated test for "Apply visual swatch attribute filter on layered navigation"
1 parent f543ced commit 7491d77

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/Listing/ConfigurableTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,6 @@ protected function setUp(): void
8383
$this->productRepository->cleanCache();
8484
$this->block = $this->objectManager->get(LayoutInterface::class)->createBlock(Configurable::class);
8585
$this->request = $this->objectManager->get(RequestInterface::class);
86-
$this->request->clearParams();
87-
}
88-
89-
/**
90-
* @inheritdoc
91-
*/
92-
protected function tearDown(): void
93-
{
94-
$this->request->clearParams();
95-
96-
parent::tearDown();
9786
}
9887

9988
/**

dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_images.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use Magento\Catalog\Api\Data\ProductExtensionInterfaceFactory;
99
use Magento\Catalog\Api\ProductRepositoryInterface;
10-
use Magento\Catalog\Model\ProductFactory;
1110
use Magento\TestFramework\Helper\Bootstrap;
1211
use Magento\TestFramework\Workaround\Override\Fixture\Resolver;
1312

@@ -21,15 +20,16 @@
2120
$objectManager = Bootstrap::getObjectManager();
2221
/** @var ProductRepositoryInterface $productRepository */
2322
$productRepository = $objectManager->get(ProductRepositoryInterface::class);
23+
$configurableProduct = $productRepository->get('configurable');
24+
$children = $configurableProduct->getTypeInstance()->getUsedProducts($configurableProduct);
2425
$images = ['magento_image.jpg', 'magento_small_image.jpg', 'magento_thumbnail.jpg'];
25-
foreach (range(1, 3) as $index) {
26-
$product = $productRepository->get('simple_option_' . $index);
27-
$product->setImage('/m/a/' . $images[$index - 1])
28-
->setSmallImage('/m/a/' . $images[$index - 1])
29-
->setThumbnail('/m/a/' . $images[$index - 1])
26+
foreach ($children as $index => $product) {
27+
$product->setImage('/m/a/' . $images[$index])
28+
->setSmallImage('/m/a/' . $images[$index])
29+
->setThumbnail('/m/a/' . $images[$index])
3030
->setData('media_gallery', ['images' => [
3131
[
32-
'file' => '/m/a/' . $images[$index - 1],
32+
'file' => '/m/a/' . $images[$index],
3333
'position' => 1,
3434
'label' => 'Image Alt Text',
3535
'disabled' => 0,

0 commit comments

Comments
 (0)