@@ -116,7 +116,75 @@ public function getTestCases()
116
116
// 110 + 30
117
117
'maximalPrice ' => 140
118
118
]
119
- ]
119
+ ],
120
+
121
+ '
122
+ #5 Testing price for fixed bundle product
123
+ with fixed sub items, fixed options and without any discounts
124
+ ' => [
125
+ 'strategy ' => $ this ->getBundleConfiguration3 (
126
+ LinkInterface::PRICE_TYPE_FIXED ,
127
+ self ::CUSTOM_OPTION_PRICE_TYPE_FIXED
128
+ ),
129
+ 'expectedResults ' => [
130
+ // 110 + 1 * 20 + 100
131
+ 'minimalPrice ' => 230 ,
132
+
133
+ // 110 + 1 * 20 + 100
134
+ 'maximalPrice ' => 230
135
+ ]
136
+ ],
137
+
138
+ '
139
+ #6 Testing price for fixed bundle product
140
+ with percent sub items, percent options and without any discounts
141
+ ' => [
142
+ 'strategy ' => $ this ->getBundleConfiguration3 (
143
+ LinkInterface::PRICE_TYPE_PERCENT ,
144
+ self ::CUSTOM_OPTION_PRICE_TYPE_PERCENT
145
+ ),
146
+ 'expectedResults ' => [
147
+ // 110 + 110 * 0.2 + 110 * 1
148
+ 'minimalPrice ' => 242 ,
149
+
150
+ // 110 + 110 * 0.2 + 110 * 1
151
+ 'maximalPrice ' => 242
152
+ ]
153
+ ],
154
+
155
+ '
156
+ #7 Testing price for fixed bundle product
157
+ with fixed sub items, percent options and without any discounts
158
+ ' => [
159
+ 'strategy ' => $ this ->getBundleConfiguration3 (
160
+ LinkInterface::PRICE_TYPE_FIXED ,
161
+ self ::CUSTOM_OPTION_PRICE_TYPE_PERCENT
162
+ ),
163
+ 'expectedResults ' => [
164
+ // 110 + 1 * 20 + 110 * 1
165
+ 'minimalPrice ' => 240 ,
166
+
167
+ // 110 + 1 * 20 + 110 * 1
168
+ 'maximalPrice ' => 240
169
+ ]
170
+ ],
171
+
172
+ '
173
+ #8 Testing price for fixed bundle product
174
+ with percent sub items, fixed options and without any discounts
175
+ ' => [
176
+ 'strategy ' => $ this ->getBundleConfiguration3 (
177
+ LinkInterface::PRICE_TYPE_PERCENT ,
178
+ self ::CUSTOM_OPTION_PRICE_TYPE_FIXED
179
+ ),
180
+ 'expectedResults ' => [
181
+ // 110 + 110 * 0.2 + 100
182
+ 'minimalPrice ' => 232 ,
183
+
184
+ // 110 + 110 * 0.2 + 100
185
+ 'maximalPrice ' => 232
186
+ ]
187
+ ],
120
188
];
121
189
}
122
190
@@ -275,4 +343,51 @@ private function getProductWithDifferentPrice()
275
343
],
276
344
];
277
345
}
346
+
347
+ /**
348
+ * Fixed bundle product with required option, custom option and without any discounts
349
+ * @param $selectionsPriceType
350
+ * @param $customOptionsPriceType
351
+ * @return array
352
+ */
353
+ private function getBundleConfiguration3 ($ selectionsPriceType , $ customOptionsPriceType )
354
+ {
355
+ $ optionsData = [
356
+ [
357
+ 'title ' => 'Op1 ' ,
358
+ 'required ' => true ,
359
+ 'type ' => 'checkbox ' ,
360
+ 'links ' => [
361
+ [
362
+ 'sku ' => 'simple1 ' ,
363
+ 'qty ' => 1 ,
364
+ 'price ' => 20 ,
365
+ 'price_type ' => $ selectionsPriceType
366
+ ],
367
+ ]
368
+ ],
369
+ ];
370
+
371
+ $ customOptionsData = [
372
+ [
373
+ 'price_type ' => $ customOptionsPriceType ,
374
+ 'title ' => 'Test Field ' ,
375
+ 'type ' => 'field ' ,
376
+ 'is_require ' => 1 ,
377
+ 'price ' => 100 ,
378
+ 'sku ' => '1-text ' ,
379
+ ]
380
+ ];
381
+
382
+ return [
383
+ [
384
+ 'modifierName ' => 'addSimpleProduct ' ,
385
+ 'data ' => [$ optionsData ]
386
+ ],
387
+ [
388
+ 'modifierName ' => 'addCustomOption ' ,
389
+ 'data ' => [$ customOptionsData ]
390
+ ],
391
+ ];
392
+ }
278
393
}
0 commit comments