Skip to content

Commit 69ee309

Browse files
author
vnayda
committed
MAGETWO-59953: [Backport] Configurable product option price is displayed incorrectly per website for 2.1.3
- add integration test
1 parent 702db48 commit 69ee309

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,38 @@ public function testGetProductsIfOneOfChildIsDisabled()
6868
$this->assertEquals(20, $lowestPriceChildrenProduct->getPrice());
6969
}
7070

71+
/**
72+
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
73+
*/
74+
public function testGetProductsIfOneOfChildIsDisabledPerWebsite()
75+
{
76+
$configurableProduct = $this->productRepository->getById(1, false, null, true);
77+
$lowestPriceChildrenProducts = $this->lowestPriceOptionsProvider->getProducts($configurableProduct);
78+
$this->assertCount(1, $lowestPriceChildrenProducts);
79+
$lowestPriceChildrenProduct = reset($lowestPriceChildrenProducts);
80+
$this->assertEquals(10, $lowestPriceChildrenProduct->getPrice());
81+
82+
// load full aggregation root
83+
$lowestPriceChildProduct = $this->productRepository->get(
84+
$lowestPriceChildrenProduct->getSku(),
85+
false,
86+
null,
87+
true
88+
);
89+
$lowestPriceChildProduct->setStatus(Status::STATUS_DISABLED);
90+
// update in default store scope
91+
$currentStoreId = $this->storeManager->getStore()->getId();
92+
$defaultStore = $this->storeManager->getDefaultStoreView();
93+
$this->storeManager->setCurrentStore($defaultStore->getId());
94+
$this->productRepository->save($lowestPriceChildProduct);
95+
$this->storeManager->setCurrentStore($currentStoreId);
96+
97+
$lowestPriceChildrenProducts = $this->lowestPriceOptionsProvider->getProducts($configurableProduct);
98+
$this->assertCount(1, $lowestPriceChildrenProducts);
99+
$lowestPriceChildrenProduct = reset($lowestPriceChildrenProducts);
100+
$this->assertEquals(20, $lowestPriceChildrenProduct->getPrice());
101+
}
102+
71103
/**
72104
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
73105
*/

0 commit comments

Comments
 (0)