From 9a4db6ba04359b7b603bad571fae65ffc2d3724e Mon Sep 17 00:00:00 2001 From: Michail Slabko <mslabko@magento.com> Date: Fri, 11 Nov 2016 18:05:54 +0200 Subject: [PATCH] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60826: Wrong Regular price for dynamic bundle --- ...icBundleWithSpecialPriceCalculatorTest.php | 2 +- .../FixedBundlePriceCalculatorTest.php | 117 ++++++- ...edBundleWithSpecialPriceCalculatorTest.php | 288 ++++-------------- ...amic_bundle_product_with_special_price.php | 2 - .../PriceCalculator/fixed_bundle_product.php | 4 +- ...ixed_bundle_product_with_special_price.php | 17 ++ ...le_product_with_special_price_rollback.php | 7 + 7 files changed, 200 insertions(+), 237 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php index 1001cf39c62..63efce39455 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php @@ -53,7 +53,7 @@ class DynamicBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract $this->assertEquals( $expectedResults['regularMaximalPrice'], $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(), - 'Failed to check minimal regular price on product' + 'Failed to check maximal regular price on product' ); } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php index 28e4886fb16..31ceea07ee2 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php @@ -116,7 +116,75 @@ class FixedBundlePriceCalculatorTest extends BundlePriceAbstract // 110 + 30 'maximalPrice' => 140 ] - ] + ], + + ' + #5 Testing price for fixed bundle product + with fixed sub items, fixed options and without any discounts + ' => [ + 'strategy' => $this->getBundleConfiguration3( + LinkInterface::PRICE_TYPE_FIXED, + self::CUSTOM_OPTION_PRICE_TYPE_FIXED + ), + 'expectedResults' => [ + // 110 + 1 * 20 + 100 + 'minimalPrice' => 230, + + // 110 + 1 * 20 + 100 + 'maximalPrice' => 230 + ] + ], + + ' + #6 Testing price for fixed bundle product + with percent sub items, percent options and without any discounts + ' => [ + 'strategy' => $this->getBundleConfiguration3( + LinkInterface::PRICE_TYPE_PERCENT, + self::CUSTOM_OPTION_PRICE_TYPE_PERCENT + ), + 'expectedResults' => [ + // 110 + 110 * 0.2 + 110 * 1 + 'minimalPrice' => 242, + + // 110 + 110 * 0.2 + 110 * 1 + 'maximalPrice' => 242 + ] + ], + + ' + #7 Testing price for fixed bundle product + with fixed sub items, percent options and without any discounts + ' => [ + 'strategy' => $this->getBundleConfiguration3( + LinkInterface::PRICE_TYPE_FIXED, + self::CUSTOM_OPTION_PRICE_TYPE_PERCENT + ), + 'expectedResults' => [ + // 110 + 1 * 20 + 110 * 1 + 'minimalPrice' => 240, + + // 110 + 1 * 20 + 110 * 1 + 'maximalPrice' => 240 + ] + ], + + ' + #8 Testing price for fixed bundle product + with percent sub items, fixed options and without any discounts + ' => [ + 'strategy' => $this->getBundleConfiguration3( + LinkInterface::PRICE_TYPE_PERCENT, + self::CUSTOM_OPTION_PRICE_TYPE_FIXED + ), + 'expectedResults' => [ + // 110 + 110 * 0.2 + 100 + 'minimalPrice' => 232, + + // 110 + 110 * 0.2 + 100 + 'maximalPrice' => 232 + ] + ], ]; } @@ -275,4 +343,51 @@ class FixedBundlePriceCalculatorTest extends BundlePriceAbstract ], ]; } + + /** + * Fixed bundle product with required option, custom option and without any discounts + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration3($selectionsPriceType, $customOptionsPriceType) + { + $optionsData = [ + [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', + 'links' => [ + [ + 'sku' => 'simple1', + 'qty' => 1, + 'price' => 20, + 'price_type' => $selectionsPriceType + ], + ] + ], + ]; + + $customOptionsData = [ + [ + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', + ] + ]; + + return [ + [ + 'modifierName' => 'addSimpleProduct', + 'data' => [$optionsData] + ], + [ + 'modifierName' => 'addCustomOption', + 'data' => [$customOptionsData] + ], + ]; + } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php index 55fe57d0826..183e5cc3304 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php @@ -9,7 +9,7 @@ namespace Magento\Bundle\Model\Product; use \Magento\Bundle\Api\Data\LinkInterface; /** - * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php + * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price.php * @magentoAppArea frontend */ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract @@ -52,23 +52,9 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract return [ ' #1 Testing price for fixed bundle product - without any discounts, sub items and options - ' => [ - 'strategy' => $this->getBundleConfiguration1(), - 'expectedResults' => [ - // just product price - 'minimalPrice' => 110, - - // just product price - 'maximalPrice' => 110 - ] - ], - - ' - #2 Testing price for fixed bundle product with special price and without any sub items and options ' => [ - 'strategy' => $this->getBundleConfiguration2(), + 'strategy' => $this->getBundleConfiguration1(), 'expectedResults' => [ // 110 * 0.5 'minimalPrice' => 55, @@ -79,78 +65,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #3 Testing price for fixed bundle product - with fixed sub items, fixed options and without any discounts - ' => [ - 'strategy' => $this->getBundleConfiguration3( - LinkInterface::PRICE_TYPE_FIXED, - self::CUSTOM_OPTION_PRICE_TYPE_FIXED - ), - 'expectedResults' => [ - // 110 + 1 * 20 + 100 - 'minimalPrice' => 230, - - // 110 + 1 * 20 + 100 - 'maximalPrice' => 230 - ] - ], - - ' - #4 Testing price for fixed bundle product - with percent sub items, percent options and without any discounts - ' => [ - 'strategy' => $this->getBundleConfiguration3( - LinkInterface::PRICE_TYPE_PERCENT, - self::CUSTOM_OPTION_PRICE_TYPE_PERCENT - ), - 'expectedResults' => [ - // 110 + 110 * 0.2 + 110 * 1 - 'minimalPrice' => 242, - - // 110 + 110 * 0.2 + 110 * 1 - 'maximalPrice' => 242 - ] - ], - - ' - #5 Testing price for fixed bundle product - with fixed sub items, percent options and without any discounts - ' => [ - 'strategy' => $this->getBundleConfiguration3( - LinkInterface::PRICE_TYPE_FIXED, - self::CUSTOM_OPTION_PRICE_TYPE_PERCENT - ), - 'expectedResults' => [ - // 110 + 1 * 20 + 110 * 1 - 'minimalPrice' => 240, - - // 110 + 1 * 20 + 110 * 1 - 'maximalPrice' => 240 - ] - ], - - ' - #6 Testing price for fixed bundle product - with percent sub items, fixed options and without any discounts - ' => [ - 'strategy' => $this->getBundleConfiguration3( - LinkInterface::PRICE_TYPE_PERCENT, - self::CUSTOM_OPTION_PRICE_TYPE_FIXED - ), - 'expectedResults' => [ - // 110 + 110 * 0.2 + 100 - 'minimalPrice' => 232, - - // 110 + 110 * 0.2 + 100 - 'maximalPrice' => 232 - ] - ], - - ' - #7 Testing price for fixed bundle product + #2 Testing price for fixed bundle product with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration4( + 'strategy' => $this->getBundleConfiguration2( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -164,10 +82,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #8 Testing price for fixed bundle product + #3 Testing price for fixed bundle product with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration4( + 'strategy' => $this->getBundleConfiguration2( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -181,10 +99,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #9 Testing price for fixed bundle product + #4 Testing price for fixed bundle product with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration4( + 'strategy' => $this->getBundleConfiguration2( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -198,10 +116,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #10 Testing price for fixed bundle product + #5 Testing price for fixed bundle product with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration4( + 'strategy' => $this->getBundleConfiguration2( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -215,10 +133,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #11 Testing price for fixed bundle product + #6 Testing price for fixed bundle product with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration5( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -232,10 +150,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #12 Testing price for fixed bundle product + #7 Testing price for fixed bundle product with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration5( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -249,10 +167,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #13 Testing price for fixed bundle product + #8 Testing price for fixed bundle product with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration5( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -266,10 +184,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #14 Testing price for fixed bundle product + #9 Testing price for fixed bundle product with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration5( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -283,10 +201,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #15 Testing price for fixed bundle product + #10 Testing price for fixed bundle product with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration6( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -300,10 +218,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #16 Testing price for fixed bundle product + #11 Testing price for fixed bundle product with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration6( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -317,10 +235,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #17 Testing price for fixed bundle product + #12 Testing price for fixed bundle product with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration6( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -334,10 +252,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #18 Testing price for fixed bundle product + #13 Testing price for fixed bundle product with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration6( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -351,10 +269,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #19 Testing price for fixed bundle product + #14 Testing price for fixed bundle product with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration7( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -368,10 +286,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #20 Testing price for fixed bundle product + #15 Testing price for fixed bundle product with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration7( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -385,10 +303,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #21 Testing price for fixed bundle product + #16 Testing price for fixed bundle product with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration7( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -402,10 +320,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #22 Testing price for fixed bundle product + #17 Testing price for fixed bundle product with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration7( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -419,10 +337,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #23 Testing price for fixed bundle product + #18 Testing price for fixed bundle product with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration8( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -436,10 +354,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #24 Testing price for fixed bundle product + #19 Testing price for fixed bundle product with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration8( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -453,10 +371,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #25 Testing price for fixed bundle product + #20 Testing price for fixed bundle product with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration8( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -470,10 +388,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #26 Testing price for fixed bundle product + #21 Testing price for fixed bundle product with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration8( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -487,10 +405,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #27 Testing price for fixed bundle product + #22 Testing price for fixed bundle product with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration9( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -504,10 +422,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #28 Testing price for fixed bundle product + #23 Testing price for fixed bundle product with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration9( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -521,10 +439,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #29 Testing price for fixed bundle product + #24 Testing price for fixed bundle product with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration9( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -538,10 +456,10 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ' - #30 Testing price for fixed bundle product + #25 Testing price for fixed bundle product with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration9( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -557,7 +475,7 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract } /** - * Fixed bundle product without any discounts, sub items and options + * Fixed bundle product with special price and without any sub items and options * @return array */ private function getBundleConfiguration1() @@ -565,74 +483,13 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract return []; } - /** - * Fixed bundle product with special price and without any sub items and options - * @return array - */ - private function getBundleConfiguration2() - { - return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], - ]; - } - - /** - * Fixed bundle product with required option, custom option and without any discounts - * @param $selectionsPriceType - * @param $customOptionsPriceType - * @return array - */ - private function getBundleConfiguration3($selectionsPriceType, $customOptionsPriceType) - { - $optionsData = [ - [ - 'title' => 'Op1', - 'required' => true, - 'type' => 'checkbox', - 'links' => [ - [ - 'sku' => 'simple1', - 'qty' => 1, - 'price' => 20, - 'price_type' => $selectionsPriceType - ], - ] - ], - ]; - - $customOptionsData = [ - [ - 'price_type' => $customOptionsPriceType, - 'title' => 'Test Field', - 'type' => 'field', - 'is_require' => 1, - 'price' => 100, - 'sku' => '1-text', - ] - ]; - - return [ - [ - 'modifierName' => 'addSimpleProduct', - 'data' => [$optionsData] - ], - [ - 'modifierName' => 'addCustomOption', - 'data' => [$customOptionsData] - ], - ]; - } - /** * Fixed bundle product with required option, custom option and with special price * @param $selectionsPriceType * @param $customOptionsPriceType * @return array */ - private function getBundleConfiguration4( + private function getBundleConfiguration2( $selectionsPriceType, $customOptionsPriceType ) { @@ -664,10 +521,6 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -685,7 +538,7 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract * @param $customOptionsPriceType * @return array */ - private function getBundleConfiguration5( + private function getBundleConfiguration3( $selectionsPriceType, $customOptionsPriceType ) { @@ -717,10 +570,6 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -738,7 +587,7 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract * @param $customOptionsPriceType * @return array */ - private function getBundleConfiguration6( + private function getBundleConfiguration4( $selectionsPriceType, $customOptionsPriceType ) { @@ -776,10 +625,6 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -797,7 +642,7 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract * @param $customOptionsPriceType * @return array */ - private function getBundleConfiguration7( + private function getBundleConfiguration5( $selectionsPriceType, $customOptionsPriceType ) { @@ -835,10 +680,6 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -856,7 +697,7 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract * @param $customOptionsPriceType * @return array */ - private function getBundleConfiguration8( + private function getBundleConfiguration6( $selectionsPriceType, $customOptionsPriceType ) { @@ -894,10 +735,6 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -915,7 +752,7 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract * @param $customOptionsPriceType * @return array */ - private function getBundleConfiguration9( + private function getBundleConfiguration7( $selectionsPriceType, $customOptionsPriceType ) { @@ -972,10 +809,6 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -986,11 +819,4 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract ], ]; } - - protected function addSpecialPrice(\Magento\Catalog\Model\Product $bundleProduct, $discount) - { - $bundleProduct->setSpecialPrice($discount); - - return $bundleProduct; - } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php index 37f8295e43c..4b29c72e162 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php @@ -16,8 +16,6 @@ $productRepository ->setSpecialPrice(50) ->save(); -$productRepository->save($product); - $productRepository ->get('simple2') ->setSpecialPrice(2.5) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php index a8f3974f658..68dcbbe1c0c 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php @@ -15,12 +15,12 @@ $product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) ->setId(42) ->setAttributeSetId(4) ->setWebsiteIds([1]) - ->setName('Spherical Bundle Product in a Vacuum') + ->setName('Bundle Product') ->setSku('bundle_product') ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]) - ->setPriceView(1) + ->setPriceView(0) ->setPriceType(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED) ->setPrice(110.0) ->setShipmentType(0); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price.php new file mode 100644 index 00000000000..3d3e92f7ac6 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price.php @@ -0,0 +1,17 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +require __DIR__ . '/fixed_bundle_product.php'; + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + +/** @var $product \Magento\Catalog\Model\Product */ +$productRepository + ->get('bundle_product') + ->setSpecialPrice(50) + ->save(); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price_rollback.php new file mode 100644 index 00000000000..8a0059e1208 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price_rollback.php @@ -0,0 +1,7 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +require __DIR__ . '/fixed_bundle_product_rollback.php'; -- GitLab