Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.4-develop' into refactor/mftf-…
Browse files Browse the repository at this point in the history
…customer

# Conflicts:
#	app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml
  • Loading branch information
lbajsarowicz committed Jan 9, 2020
2 parents 0652d0e + 7ccd640 commit b5500f7
Show file tree
Hide file tree
Showing 92 changed files with 2,153 additions and 421 deletions.
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminLogoutActionGroup">
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/>
</actionGroup>
</actionGroups>
Expand Up @@ -80,6 +80,7 @@
<argument name="type" xsi:type="string">options</argument>
<argument name="width" xsi:type="string">120</argument>
<argument name="align" xsi:type="string">left</argument>
<argument name="sortable" xsi:type="string">0</argument>
<argument name="options" xsi:type="array">
<item name="disabled" xsi:type="array">
<item name="value" xsi:type="string">0</item>
Expand Down
Expand Up @@ -79,7 +79,7 @@
<waitForPageLoad stepKey="waitForElementAdded"/>

<!-- Go to the shopping cart page and grab the value of the option title -->
<amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart"/>
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart"/>
<waitForPageLoad stepKey="waitForCartPageLoad"/>
<grabTextFrom selector="{{CheckoutCartProductSection.nthBundleOptionName('1')}}" stepKey="grabTotalBefore"/>

Expand All @@ -100,7 +100,7 @@
<see stepKey="assertSuccess2" selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product."/>

<!-- Go to the shopping cart page and make sure the title has changed -->
<amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart1"/>
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart1"/>
<waitForPageLoad stepKey="waitForCartPageLoad1"/>
<grabTextFrom selector="{{CheckoutCartProductSection.nthBundleOptionName('1')}}" stepKey="grabTotalAfter"/>
<assertNotEquals expected="{$grabTotalBefore}" expectedType="string" actual="{$grabTotalAfter}" actualType="string" stepKey="assertNotEquals"/>
Expand Down
Expand Up @@ -86,7 +86,7 @@
<waitForPageLoad stepKey="waitForElementAdded2"/>

<!-- Go to the shopping cart page and edit the first product -->
<amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart"/>
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart"/>
<waitForPageLoad stepKey="waitForCartPageLoad"/>
<waitForElementVisible stepKey="waitForInfoDropdown" selector="{{CheckoutCartSummarySection.total}}"/>
<waitForPageLoad stepKey="waitForCartPageLoad3"/>
Expand All @@ -104,7 +104,7 @@
<waitForPageLoad stepKey="waitForElementAdded3"/>

<!-- Go to the shopping cart page -->
<amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart2"/>
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart2"/>
<waitForPageLoad stepKey="waitForCartPageLoad2"/>

<!-- Assert that the options are both there and the proce no longer matches -->
Expand Down
Expand Up @@ -7,7 +7,7 @@
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="CaptchaFormsDisplayingSection">
<element name="store" type="button" selector="#menu-magento-backend-stores"/>
<element name="config" type="button" selector="//li[@data-ui-id='menu-magento-config-system-config']//span"/>
Expand Down
Expand Up @@ -3,16 +3,14 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

/**
* Product options abstract type block
*
* @author Magento Core Team <core@magentocommerce.com>
*/
declare(strict_types=1);

namespace Magento\Catalog\Block\Product\View\Options;

use Magento\Catalog\Pricing\Price\BasePrice;
use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule;
use Magento\Catalog\Pricing\Price\CustomOptionPriceInterface;
use Magento\Framework\App\ObjectManager;

/**
* Product options section abstract block.
Expand Down Expand Up @@ -47,20 +45,29 @@ abstract class AbstractOptions extends \Magento\Framework\View\Element\Template
*/
protected $_catalogHelper;

/**
* @var CalculateCustomOptionCatalogRule
*/
private $calculateCustomOptionCatalogRule;

/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Framework\Pricing\Helper\Data $pricingHelper
* @param \Magento\Catalog\Helper\Data $catalogData
* @param array $data
* @param CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\Pricing\Helper\Data $pricingHelper,
\Magento\Catalog\Helper\Data $catalogData,
array $data = []
array $data = [],
CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null
) {
$this->pricingHelper = $pricingHelper;
$this->_catalogHelper = $catalogData;
$this->calculateCustomOptionCatalogRule = $calculateCustomOptionCatalogRule
?? ObjectManager::getInstance()->get(CalculateCustomOptionCatalogRule::class);
parent::__construct($context, $data);
}

Expand Down Expand Up @@ -161,6 +168,15 @@ protected function _formatPrice($value, $flag = true)
$priceStr = $sign;

$customOptionPrice = $this->getProduct()->getPriceInfo()->getPrice('custom_option_price');

if (!$value['is_percent']) {
$value['pricing_value'] = $this->calculateCustomOptionCatalogRule->execute(
$this->getProduct(),
(float)$value['pricing_value'],
(bool)$value['is_percent']
);
}

$context = [CustomOptionPriceInterface::CONFIGURATION_OPTION_FLAG => true];
$optionAmount = $customOptionPrice->getCustomAmount($value['pricing_value'], null, $context);
$priceStr .= $this->getLayout()->getBlock('product.price.render.default')->renderAmount(
Expand Down

0 comments on commit b5500f7

Please sign in to comment.