6 declare(strict_types=1);
26 public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults)
29 $bundleProduct = $this->productRepository->get(
'bundle_product',
false,
null,
true);
36 $expectedResults[
'minimalPrice'],
37 $priceInfo->getPrice($priceCode)->getMinimalPrice()->getValue(),
38 'Failed to check minimal price on product' 41 $expectedResults[
'maximalPrice'],
42 $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(),
43 'Failed to check maximal price on product' 46 $priceInfoFromIndexer = $this->productCollectionFactory->create()
47 ->addFieldToFilter(
'sku',
'bundle_product')
52 $this->assertEquals($expectedResults[
'minimalPrice'], $priceInfoFromIndexer->getMinimalPrice());
53 $this->assertEquals($expectedResults[
'maximalPrice'], $priceInfoFromIndexer->getMaxPrice());
65 public function testPriceForDynamicBundleInWebsiteScope(array $strategyModifiers, array $expectedResults)
68 $bundleProduct = $this->productRepository->get(
'bundle_product',
false,
null,
true);
75 $expectedResults[
'minimalPrice'],
76 $priceInfo->getPrice($priceCode)->getMinimalPrice()->getValue(),
77 'Failed to check minimal price on product' 80 $expectedResults[
'maximalPrice'],
81 $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(),
82 'Failed to check maximal price on product' 85 $priceInfoFromIndexer = $this->productCollectionFactory->create()
86 ->addFieldToFilter(
'sku',
'bundle_product')
91 $this->assertEquals($expectedResults[
'minimalPrice'], $priceInfoFromIndexer->getMinimalPrice());
92 $this->assertEquals($expectedResults[
'maximalPrice'], $priceInfoFromIndexer->getMaxPrice());
102 '#1 Testing price for dynamic bundle product with one simple' => [
103 'strategy' => $this->getBundleConfiguration1(),
104 'expectedResults' => [
106 'minimalPrice' => 10,
112 '#2 Testing price for dynamic bundle product with three simples and different qty' => [
113 'strategy' => $this->getBundleConfiguration2(),
114 'expectedResults' => [
116 'minimalPrice' => 30,
118 'maximalPrice' => 100
122 '#3 Testing price for dynamic bundle product with four simples and different price' => [
123 'strategy' => $this->getBundleConfiguration3(),
124 'expectedResults' => [
126 'minimalPrice' => 10,
132 '#4 Testing price for dynamic bundle with two non required options' => [
133 'strategy' => $this->getBundleConfiguration4(),
134 'expectedResults' => [
136 'minimalPrice' => 10,
138 'maximalPrice' => 130
142 '#5 Testing price for dynamic bundle with two required options' => [
143 'strategy' => $this->getBundleConfiguration5(),
144 'expectedResults' => [
146 'minimalPrice' => 20,
148 'maximalPrice' => 130
159 private function getBundleConfiguration1()
165 'type' =>
'checkbox',
177 'modifierName' =>
'addSimpleProduct',
188 private function getBundleConfiguration2()
194 'type' =>
'checkbox',
214 'modifierName' =>
'addSimpleProduct',
225 private function getBundleConfiguration3()
231 'type' =>
'checkbox',
251 'modifierName' =>
'addSimpleProduct',
261 private function getBundleConfiguration4()
282 'type' =>
'checkbox',
298 'modifierName' =>
'addSimpleProduct',
308 private function getBundleConfiguration5()
329 'type' =>
'checkbox',
345 'modifierName' =>
'addSimpleProduct',
prepareFixture($strategyModifiers, $productSku)