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 if (isset($expectedResults[
'regularMinimalPrice'])) {
45 $expectedResults[
'regularMinimalPrice'],
46 $priceInfo->getPrice($priceCode)->getMinimalPrice()->getValue(),
47 'Failed to check minimal regular price on product' 51 if (isset($expectedResults[
'regularMaximalPrice'])) {
54 $expectedResults[
'regularMaximalPrice'],
55 $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(),
56 'Failed to check maximal regular price on product' 60 $priceInfoFromIndexer = $this->productCollectionFactory->create()
61 ->addFieldToFilter(
'sku',
'bundle_product')
66 $this->assertEquals($expectedResults[
'minimalPrice'], $priceInfoFromIndexer->getMinimalPrice());
67 $this->assertEquals($expectedResults[
'maximalPrice'], $priceInfoFromIndexer->getMaxPrice());
78 '#1 Testing price for dynamic bundle with one required option and special price' => [
79 'strategy' => $this->getBundleConfiguration1(),
80 'expectedResults' => [
88 '#2 Testing price for dynamic bundle with one non required option and special price' => [
89 'strategy' => $this->getBundleConfiguration2(),
90 'expectedResults' => [
100 #3 Testing price for dynamic bundle 101 with one required checkbox type option, two simples and special price 103 'strategy' => $this->getBundleConfiguration3(),
104 'expectedResults' => [
108 'maximalPrice' => 50,
113 #4 Testing price for dynamic bundle 114 with one required multi type option, two simples with special price 116 'strategy' => $this->getBundleConfiguration4(),
117 'expectedResults' => [
119 'minimalPrice' => 4.95,
121 'maximalPrice' => 9.95,
125 '#5 Testing price for dynamic bundle with one required option, one non required and special price' => [
126 'strategy' => $this->getBundleConfiguration5(),
127 'expectedResults' => [
129 'minimalPrice' => 3.75,
131 'maximalPrice' => 39.5,
133 'regularMinimalPrice' =>
'10',
135 'regularMaximalPrice' =>
'129',
139 '#6 Testing price for dynamic bundle with one simple product with special price' => [
140 'strategy' => $this->getBundleConfiguration6(),
141 'expectedResults' => [
143 'minimalPrice' => 4.95,
155 private function getBundleConfiguration1()
161 'type' =>
'checkbox',
173 'modifierName' =>
'addSimpleProduct',
183 private function getBundleConfiguration2()
188 'type' =>
'checkbox',
201 'modifierName' =>
'addSimpleProduct',
211 private function getBundleConfiguration3()
217 'type' =>
'checkbox',
233 'modifierName' =>
'addSimpleProduct',
243 private function getBundleConfiguration4()
249 'type' =>
'checkbox',
265 'modifierName' =>
'addSimpleProduct',
275 private function getBundleConfiguration5()
296 'type' =>
'checkbox',
312 'modifierName' =>
'addSimpleProduct',
322 private function getBundleConfiguration6()
344 'modifierName' =>
'addSimpleProduct',
prepareFixture($strategyModifiers, $productSku)