Skip to content

Commit

Permalink
Merge branch '2.4-develop' of https://github.com/mage-os/mirror-magento2
Browse files Browse the repository at this point in the history
 into 2.4-develop
  • Loading branch information
mage-os-ci committed Dec 9, 2023
2 parents 7087713 + 6b34507 commit ead1c66
Show file tree
Hide file tree
Showing 31 changed files with 293 additions and 271 deletions.
16 changes: 10 additions & 6 deletions app/code/Magento/Backend/Model/Menu/Director/Director.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

namespace Magento\Backend\Model\Menu\Director;

use Magento\Backend\Model\Menu\Builder;
use Magento\Backend\Model\Menu\Builder\AbstractCommand;
use Psr\Log\LoggerInterface;

/**
* @api
* @since 100.0.2
Expand All @@ -23,8 +27,8 @@ class Director extends \Magento\Backend\Model\Menu\AbstractDirector
* Get command object
*
* @param array $data command params
* @param \Psr\Log\LoggerInterface $logger
* @return \Magento\Backend\Model\Menu\Builder\AbstractCommand
* @param LoggerInterface $logger
* @return AbstractCommand
*/
protected function _getCommand($data, $logger)
{
Expand All @@ -41,14 +45,14 @@ protected function _getCommand($data, $logger)
* Build menu instance
*
* @param array $config
* @param \Magento\Backend\Model\Menu\Builder $builder
* @param \Psr\Log\LoggerInterface $logger
* @param Builder $builder
* @param LoggerInterface $logger
* @return void
*/
public function direct(
array $config,
\Magento\Backend\Model\Menu\Builder $builder,
\Psr\Log\LoggerInterface $logger
Builder $builder,
LoggerInterface $logger
) {
foreach ($config as $data) {
$builder->processCommand($this->_getCommand($data, $logger));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function getValue()
if (!$this->useRegularPrice) {
$value = $this->discountCalculator->calculateDiscount($this->bundleProduct, $value);
}
$this->value = $this->priceCurrency->round($value);
$this->value = $this->priceCurrency->roundPrice($value, 4);
$product->setData($bundleSelectionKey, $this->value);

return $this->value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,12 @@ protected function setUp(): void
$this->productMock->expects($this->atLeastOnce())
->method('getPriceInfo')
->willReturn($this->priceInfoMock);

$this->priceCurrencyMock = $this->getMockForAbstractClass(PriceCurrencyInterface::class);


$this->priceCurrencyMock = $this->getMockBuilder(PriceCurrencyInterface::class)
->disableOriginalConstructor()
->addMethods(['roundPrice'])
->getMockForAbstractClass();

$this->quantity = 1;

$this->setupSelectionPrice();
Expand Down Expand Up @@ -169,7 +172,7 @@ public function testGetValueTypeDynamic($useRegularPrice)
}

$this->priceCurrencyMock->expects($this->once())
->method('round')
->method('roundPrice')
->with($actualPrice)
->willReturn($expectedPrice);

Expand Down Expand Up @@ -234,7 +237,7 @@ public function testGetValueTypeFixedWithSelectionPriceType(bool $useRegularPric
}

$this->priceCurrencyMock->expects($this->once())
->method('round')
->method('roundPrice')
->with($actualPrice)
->willReturn($expectedPrice);

Expand Down Expand Up @@ -282,7 +285,7 @@ public function testGetValueTypeFixedWithoutSelectionPriceType($useRegularPrice)
}

$this->priceCurrencyMock->expects($this->once())
->method('round')
->method('roundPrice')
->with($actualPrice)
->willReturn($expectedPrice);

Expand Down Expand Up @@ -343,7 +346,7 @@ public function testFixedPriceWithMultipleQty($useRegularPrice)
}

$this->priceCurrencyMock->expects($this->once())
->method('round')
->method('roundPrice')
->with($actualPrice)
->willReturn($expectedPrice);

Expand Down Expand Up @@ -405,7 +408,7 @@ public function testGetAmount()
->willReturn($price);

$this->priceCurrencyMock->expects($this->once())
->method('round')
->method('roundPrice')
->with($price)
->willReturn($price);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public function execute()
str_replace('-', '/', $this->getRequest()->getParam('type', ''))
);
$objectType = $types[0];
$reponseBody = '';
$responseBody = '';

if (class_exists($objectType) && !in_array(ConditionInterface::class, class_implements($objectType))) {
$this->getResponse()->setBody($reponseBody);
$this->getResponse()->setBody($responseBody);
return;
}

Expand All @@ -49,9 +49,9 @@ public function execute()
if ($conditionModel instanceof AbstractCondition) {
$conditionModel->setJsFormObject($this->getRequest()->getParam('form'));
$conditionModel->setFormName($formNamespace);
$reponseBody = $conditionModel->asHtmlRecursive();
$responseBody = $conditionModel->asHtmlRecursive();
}

$this->getResponse()->setBody($reponseBody);
$this->getResponse()->setBody($responseBody);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@
* See COPYING.txt for license details.
*/

/** @var \Magento\CatalogWidget\Block\Product\Widget\Conditions $block */
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
use Magento\CatalogWidget\Block\Product\Widget\Conditions;
use Magento\Framework\View\Helper\SecureHtmlRenderer;
use Magento\Framework\Escaper;

/** @var Conditions $block */
/** @var SecureHtmlRenderer $secureRenderer */
/** @var Escaper $escaper */

// phpcs:disable Generic.Files.LineLength.TooLong
?>
<?php
$element = $block->getElement();
$fieldId = $element->getHtmlContainerId() ? ' id="' . $block->escapeHtmlAttr($element->getHtmlContainerId()) . '"' : '';
$fieldClass = 'field admin__field field-' . $block->escapeHtmlAttr($element->getId()) . ' '
. $block->escapeHtmlAttr($element->getCssClass());
$fieldId = $element->getHtmlContainerId() ?
' id="' . $escaper->escapeHtmlAttr($element->getHtmlContainerId()) . '"' : '';
$fieldClass = 'field admin__field field-' . $escaper->escapeHtmlAttr((string)$element->getId()) . ' '
. $escaper->escapeHtmlAttr($element->getCssClass());
$fieldClass .= $element->getRequired() ? ' required' : '';
$fieldAttributes = $fieldId . ' class="' . $fieldClass . '" '
. $block->getUiId('form-field', $block->escapeHtmlAttr($element->getId()));
. $block->getUiId('form-field', $escaper->escapeHtmlAttr((string)$element->getId()));
?>
<div<?= /* @noEscape */ $fieldAttributes ?>>
<?= $element->getLabelHtml() ?>
Expand All @@ -31,8 +40,9 @@ $fieldAttributes = $fieldId . ' class="' . $fieldClass . '" '
"Magento_Rule/rules",
"prototype"
], function(VarienRulesForm){
window.{$block->escapeJs($block->getHtmlId())} = new VarienRulesForm('{$block->escapeJs($block->getHtmlId())}',
'{$block->escapeUrl($block->getNewChildUrl())}');
window.{$escaper->escapeJs($block->getHtmlId())} = new VarienRulesForm(
'{$escaper->escapeJs($block->getHtmlId())}',
'{$escaper->escapeUrl($block->getNewChildUrl())}');
});
script;
?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
* See COPYING.txt for license details.
*/

use Magento\Catalog\Block\Product\ReviewRendererInterface;
use Magento\Catalog\Helper\Product\Compare;
use Magento\CatalogWidget\Block\Product\ProductsList;
use Magento\Framework\App\Action\Action;
use Magento\Framework\Escaper;
use Magento\Wishlist\Helper\Data;

/**
* @var \Magento\CatalogWidget\Block\Product\ProductsList $block
* @var \Magento\Framework\Escaper $escaper
*/
/** @var Escaper $escaper */
/** @var ProductsList $block */

// phpcs:disable Generic.Files.LineLength.TooLong
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper
Expand All @@ -27,13 +30,13 @@ use Magento\Framework\App\Action\Action;
$showWishlist = true;
$showCompare = true;
$showCart = true;
$templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW;
$templateType = ReviewRendererInterface::SHORT_VIEW;
$description = false;
?>
<div class="block widget block-products-list <?= /* @noEscape */ $mode ?>">
<?php if ($block->getTitle()): ?>
<div class="block-title">
<strong><?= $block->escapeHtml(__($block->getTitle())) ?></strong>
<strong><?= $escaper->escapeHtml(__($block->getTitle())) ?></strong>
</div>
<?php endif ?>
<div class="block-content">
Expand All @@ -44,15 +47,15 @@ use Magento\Framework\App\Action\Action;
<?php foreach ($items as $_item): ?>
<?= /* @noEscape */ ($iterator++ == 1) ? '<li class="product-item">' : '</li><li class="product-item">' ?>
<div class="product-item-info">
<a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo">
<a href="<?= $escaper->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo">
<?= $block->getImage($_item, $image)->toHtml() ?>
</a>
<div class="product-item-details">
<strong class="product-item-name">
<a title="<?= $block->escapeHtml($_item->getName()) ?>"
href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>"
<a title="<?= $escaper->escapeHtml($_item->getName()) ?>"
href="<?= $escaper->escapeUrl($block->getProductUrl($_item)) ?>"
class="product-item-link">
<?= $block->escapeHtml($_item->getName()) ?>
<?= $escaper->escapeHtml($_item->getName()) ?>
</a>
</strong>
<?php if ($templateType): ?>
Expand All @@ -70,14 +73,14 @@ use Magento\Framework\App\Action\Action;
<div class="actions-primary">
<?php if ($_item->isSaleable()): ?>
<?php $postParams = $block->getAddToCartPostParams($_item); ?>
<form data-role="tocart-form" data-product-sku="<?= $block->escapeHtml($_item->getSku()) ?>" action="<?= $block->escapeUrl($postParams['action']) ?>" method="post">
<input type="hidden" name="product" value="<?= $block->escapeHtmlAttr($postParams['data']['product']) ?>">
<form data-role="tocart-form" data-product-sku="<?= $escaper->escapeHtml($_item->getSku()) ?>" action="<?= $escaper->escapeUrl($postParams['action']) ?>" method="post">
<input type="hidden" name="product" value="<?= $escaper->escapeHtmlAttr($postParams['data']['product']) ?>">
<input type="hidden" name="<?= /* @noEscape */ Action::PARAM_NAME_URL_ENCODED ?>" value="<?= /* @noEscape */ $postParams['data'][Action::PARAM_NAME_URL_ENCODED] ?>">
<?= $block->getBlockHtml('formkey') ?>
<button type="submit"
title="<?= $block->escapeHtml(__('Add to Cart')) ?>"
title="<?= $escaper->escapeHtml(__('Add to Cart')) ?>"
class="action tocart primary">
<span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
<span><?= $escaper->escapeHtml(__('Add to Cart')) ?></span>
</button>
</form>
<?php if ($block->getBlockHtml('formkey')): ?>
Expand All @@ -93,25 +96,25 @@ use Magento\Framework\App\Action\Action;
<?php endif;?>
<?php else: ?>
<?php if ($_item->isAvailable()): ?>
<div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div>
<div class="stock available"><span><?= $escaper->escapeHtml(__('In stock')) ?></span></div>
<?php else: ?>
<div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div>
<div class="stock unavailable"><span><?= $escaper->escapeHtml(__('Out of stock')) ?></span></div>
<?php endif; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($showWishlist || $showCompare): ?>
<div class="actions-secondary" data-role="add-to-links">
<?php if ($this->helper(\Magento\Wishlist\Helper\Data::class)->isAllow() && $showWishlist): ?>
<?php if ($this->helper(Data::class)->isAllow() && $showWishlist): ?>
<a href="#"
data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>">
<span><?= $block->escapeHtml(__('Add to Wish List')) ?></span>
<span><?= $escaper->escapeHtml(__('Add to Wish List')) ?></span>
</a>
<?php endif; ?>
<?php if ($block->getAddToCompareUrl() && $showCompare): ?>
<?php $compareHelper = $this->helper(\Magento\Catalog\Helper\Product\Compare::class);?>
<?php $compareHelper = $this->helper(Compare::class);?>
<a href="#" class="action tocompare" data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>">
<span><?= $block->escapeHtml(__('Add to Compare')) ?></span>
<span><?= $escaper->escapeHtml(__('Add to Compare')) ?></span>
</a>
<?php endif; ?>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public function validateValue($value)
public function compactValue($value)
{
if (is_array($value)) {
ksort($value);
$value = trim(implode("\n", $value));
}
$value = [$value];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,28 @@ public function validateValueLengthDataProvider()
]
);
}

/**
* @param array $value value to pass to compactValue()
* @param string $expected expected output
*
* @dataProvider compactValueDataProvider
*/
public function testCompactValue($value, $expected)
{
$this->assertSame($expected, $this->getClass("line")->compactValue($value));
}

/**
* @return array
*/
public function compactValueDataProvider()
{
return [
[
["b"=>"element1", "a"=>"element2"],
["element2\nelement1"],
]
];
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/CustomerGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ enum CountryCodeEnum @doc(description: "The list of country codes.") {
GQ @doc(description: "Equatorial Guinea")
ER @doc(description: "Eritrea")
EE @doc(description: "Estonia")
SZ @doc(description: "Eswatini")
ET @doc(description: "Ethiopia")
FK @doc(description: "Falkland Islands")
FO @doc(description: "Faroe Islands")
Expand Down Expand Up @@ -393,7 +394,6 @@ enum CountryCodeEnum @doc(description: "The list of country codes.") {
SD @doc(description: "Sudan")
SR @doc(description: "Suriname")
SJ @doc(description: "Svalbard & Jan Mayen")
SZ @doc(description: "Swaziland")
SE @doc(description: "Sweden")
CH @doc(description: "Switzerland")
SY @doc(description: "Syria")
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Dhl/Test/Unit/Model/_files/countries.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@
<currency>SZL</currency>
<weight_unit>KG</weight_unit>
<measure_unit>CM</measure_unit>
<name>Swaziland</name>
<name>Eswatini</name>
</SZ>
<TC>
<currency>USD</currency>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Dhl/etc/countries.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@
<currency>SZL</currency>
<weight_unit>KG</weight_unit>
<measure_unit>CM</measure_unit>
<name>Swaziland</name>
<name>Eswatini</name>
</SZ>
<TC>
<currency>USD</currency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public function render(\Magento\Framework\DataObject $row)
{
/** @var \Magento\Integration\Model\Integration $row */
$text = parent::render($row);
if (!$this->isUrlSecure($row->getEndpoint()) || !$this->isUrlSecure($row->getIdentityLinkUrl())) {
if (($row->getEndpoint() && !$this->isUrlSecure($row->getEndpoint())) ||
($row->getIdentityLinkUrl() && !$this->isUrlSecure($row->getIdentityLinkUrl()))) {
$text .= '<span class="security-notice"><span>' . __("Integration not secure") . '</span></span>';
}
return $text;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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="AssertNotEqualsAdminMessageCreateIntegrationEntityActionGroup">
<arguments>
<argument name="message" type="string" defaultValue="Integration not secure"/>
</arguments>
<waitForElementVisible selector="{{AdminIntegrationsGridSection.gridName}}" stepKey="waitForMessage"/>
<dontSee selector="{{AdminIntegrationsGridSection.gridName}}" userInput="{{message}}" stepKey="doNotSeeErrorMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
<element name="rowByIndex" type="text" selector="tr[data-role='row']:nth-of-type({{var1}})" parameterized="true" timeout="30"/>
<element name="edit" type="button" selector=".data-grid .edit"/>
<element name="activate" type="button" selector="#integrationGrid_table>tbody>tr:nth-child(1)>td.col-activate>a"/>
<element name="gridName" type="block" selector=".col-name" />
</section>
</sections>
Loading

0 comments on commit ead1c66

Please sign in to comment.