22 public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults)
25 $bundleProduct = $this->productRepository->get(
'bundle_product',
false,
null,
true);
32 $expectedResults[
'minimalPrice'],
33 $priceInfo->getPrice($priceCode)->getMinimalPrice()->getValue(),
34 'Failed to check minimal price on product' 37 $expectedResults[
'maximalPrice'],
38 $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(),
39 'Failed to check maximal price on product' 42 $priceInfoFromIndexer = $this->productCollectionFactory->create()
43 ->addFieldToFilter(
'sku',
'bundle_product')
48 $this->assertEquals($expectedResults[
'minimalPrice'], $priceInfoFromIndexer->getMinimalPrice());
49 $this->assertEquals($expectedResults[
'maximalPrice'], $priceInfoFromIndexer->getMaxPrice());
61 public function testPriceForDynamicBundleInWebsiteScope(array $strategyModifiers, array $expectedResults)
64 $bundleProduct = $this->productRepository->get(
'bundle_product',
false,
null,
true);
71 $expectedResults[
'minimalPrice'],
72 $priceInfo->getPrice($priceCode)->getMinimalPrice()->getValue(),
73 'Failed to check minimal price on product' 76 $expectedResults[
'maximalPrice'],
77 $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(),
78 'Failed to check maximal price on product' 81 $priceInfoFromIndexer = $this->productCollectionFactory->create()
82 ->addFieldToFilter(
'sku',
'bundle_product')
87 $this->assertEquals($expectedResults[
'minimalPrice'], $priceInfoFromIndexer->getMinimalPrice());
88 $this->assertEquals($expectedResults[
'maximalPrice'], $priceInfoFromIndexer->getMaxPrice());
98 '#1 Testing price for dynamic bundle product with one simple' => [
99 'strategy' => $this->getBundleConfiguration1(),
100 'expectedResults' => [
102 'minimalPrice' => 10,
108 '#2 Testing price for dynamic bundle product with three simples and different qty' => [
109 'strategy' => $this->getBundleConfiguration2(),
110 'expectedResults' => [
112 'minimalPrice' => 30,
114 'maximalPrice' => 100
118 '#3 Testing price for dynamic bundle product with four simples and different price' => [
119 'strategy' => $this->getBundleConfiguration3(),
120 'expectedResults' => [
122 'minimalPrice' => 10,
128 '#4 Testing price for dynamic bundle with two non required options' => [
129 'strategy' => $this->getBundleConfiguration4(),
130 'expectedResults' => [
132 'minimalPrice' => 10,
134 'maximalPrice' => 130
138 '#5 Testing price for dynamic bundle with two required options' => [
139 'strategy' => $this->getBundleConfiguration5(),
140 'expectedResults' => [
142 'minimalPrice' => 20,
144 'maximalPrice' => 130
155 private function getBundleConfiguration1()
161 'type' =>
'checkbox',
173 'modifierName' =>
'addSimpleProduct',
184 private function getBundleConfiguration2()
190 'type' =>
'checkbox',
210 'modifierName' =>
'addSimpleProduct',
221 private function getBundleConfiguration3()
227 'type' =>
'checkbox',
247 'modifierName' =>
'addSimpleProduct',
257 private function getBundleConfiguration4()
278 'type' =>
'checkbox',
294 'modifierName' =>
'addSimpleProduct',
304 private function getBundleConfiguration5()
325 'type' =>
'checkbox',
341 'modifierName' =>
'addSimpleProduct',
prepareFixture($strategyModifiers, $productSku)