Skip to content

Commit 3750bbc

Browse files
committed
MAGETWO-66401: [Backport] - [Performance] Bump in stock SQL queries - for 2.1.6
1 parent eacfd03 commit 3750bbc

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionProviderTest.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ public function testGetProductsIfOneOfChildIsDisabled()
6363
$this->productRepository->save($lowestPriceChildProduct);
6464
$this->storeManager->setCurrentStore($currentStoreId);
6565

66-
$lowestPriceChildrenProducts = $this->lowestPriceOptionsProvider->getProducts($configurableProduct);
66+
$lowestPriceOptionsProvider = $this->recreateLowestPriceOptionsProvider();
67+
$lowestPriceChildrenProducts = $lowestPriceOptionsProvider->getProducts($configurableProduct);
68+
6769
$this->assertCount(1, $lowestPriceChildrenProducts);
6870
$lowestPriceChildrenProduct = reset($lowestPriceChildrenProducts);
6971
$this->assertEquals(20, $lowestPriceChildrenProduct->getPrice());
@@ -95,7 +97,9 @@ public function testGetProductsIfOneOfChildIsDisabledPerStore()
9597
$this->productRepository->save($lowestPriceChildProduct);
9698
$this->storeManager->setCurrentStore($currentStoreId);
9799

98-
$lowestPriceChildrenProducts = $this->lowestPriceOptionsProvider->getProducts($configurableProduct);
100+
$lowestPriceOptionsProvider = $this->recreateLowestPriceOptionsProvider();
101+
$lowestPriceChildrenProducts = $lowestPriceOptionsProvider->getProducts($configurableProduct);
102+
99103
$this->assertCount(1, $lowestPriceChildrenProducts);
100104
$lowestPriceChildrenProduct = reset($lowestPriceChildrenProducts);
101105
$this->assertEquals(20, $lowestPriceChildrenProduct->getPrice());
@@ -123,9 +127,21 @@ public function testGetProductsIfOneOfChildIsOutOfStock()
123127
$stockItem->setIsInStock(0);
124128
$this->productRepository->save($lowestPriceChildProduct);
125129

126-
$lowestPriceChildrenProducts = $this->lowestPriceOptionsProvider->getProducts($configurableProduct);
130+
$lowestPriceOptionsProvider = $this->recreateLowestPriceOptionsProvider();
131+
$lowestPriceChildrenProducts = $lowestPriceOptionsProvider->getProducts($configurableProduct);
132+
127133
$this->assertCount(1, $lowestPriceChildrenProducts);
128134
$lowestPriceChildrenProduct = reset($lowestPriceChildrenProducts);
129135
$this->assertEquals(20, $lowestPriceChildrenProduct->getPrice());
130136
}
137+
138+
/**
139+
* @return LowestPriceOptionsProviderInterface
140+
*/
141+
private function recreateLowestPriceOptionsProvider()
142+
{
143+
return Bootstrap::getObjectManager()->create(
144+
LowestPriceOptionsProviderInterface::class
145+
);
146+
}
131147
}

0 commit comments

Comments
 (0)