Skip to content

Commit 71c59ce

Browse files
authored
Merge branch '2.4-develop' into ACP2E-3916
2 parents abcf086 + a04b0ef commit 71c59ce

File tree

23 files changed

+104
-108
lines changed

23 files changed

+104
-108
lines changed

‎app/code/Magento/Backend/App/Area/FrontNameResolver.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,10 @@ public function getFrontName($checkHost = false)
107107
if ($checkHost && !$this->isHostBackend()) {
108108
return false;
109109
}
110-
$isCustomPathUsed = (bool)(string)$this->config->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_PATH);
111-
if ($isCustomPathUsed) {
112-
return (string)$this->config->getValue(self::XML_PATH_CUSTOM_ADMIN_PATH);
113-
}
114-
return $this->defaultFrontName;
110+
111+
return $this->config->isSetFlag(self::XML_PATH_USE_CUSTOM_ADMIN_PATH)
112+
? (string)$this->config->getValue(self::XML_PATH_CUSTOM_ADMIN_PATH)
113+
: $this->defaultFrontName;
115114
}
116115

117116
/**
@@ -127,9 +126,8 @@ public function isHostBackend()
127126
if (!$this->request->getServer('HTTP_HOST')) {
128127
return false;
129128
}
130-
131-
if ($this->scopeConfig->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE)) {
132-
$backendUrl = $this->scopeConfig->getValue(self::XML_PATH_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE);
129+
if ($this->scopeConfig->isSetFlag(self::XML_PATH_USE_CUSTOM_ADMIN_URL)) {
130+
$backendUrl = $this->scopeConfig->getValue(self::XML_PATH_CUSTOM_ADMIN_URL);
133131
} else {
134132
$xmlPath = $this->request->isSecure() ? Store::XML_PATH_SECURE_BASE_URL : Store::XML_PATH_UNSECURE_BASE_URL;
135133
$backendUrl = $this->config->getValue($xmlPath);

‎app/code/Magento/Backend/Test/Unit/App/Area/FrontNameResolverTest.php

100644100755
Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,16 @@ protected function setUp(): void
8080
*/
8181
public function testIfCustomPathUsed(): void
8282
{
83-
$this->configMock
83+
$this->configMock->expects($this->once())
84+
->method('isSetFlag')
85+
->with(FrontNameResolver::XML_PATH_USE_CUSTOM_ADMIN_PATH)
86+
->willReturn(true);
87+
88+
$this->configMock->expects($this->once())
8489
->method('getValue')
85-
->willReturnCallback(fn($param) => match ([$param]) {
86-
['admin/url/use_custom_path'] => true,
87-
['admin/url/custom_path'] => 'expectedValue'
88-
});
90+
->with(FrontNameResolver::XML_PATH_CUSTOM_ADMIN_PATH)
91+
->willReturn('expectedValue');
92+
8993
$this->assertEquals('expectedValue', $this->model->getFrontName());
9094
}
9195

@@ -94,15 +98,11 @@ public function testIfCustomPathUsed(): void
9498
*/
9599
public function testIfCustomPathNotUsed(): void
96100
{
97-
$this->configMock->expects(
98-
$this->once()
99-
)->method(
100-
'getValue'
101-
)->with(
102-
'admin/url/use_custom_path'
103-
)->willReturn(
104-
false
105-
);
101+
$this->configMock->expects($this->once())
102+
->method('isSetFlag')
103+
->with(FrontNameResolver::XML_PATH_USE_CUSTOM_ADMIN_PATH)
104+
->willReturn(false);
105+
106106
$this->assertEquals($this->_defaultFrontName, $this->model->getFrontName());
107107
}
108108

@@ -125,7 +125,12 @@ public function testIsHostBackend(
125125
string $customAdminUrl,
126126
bool $expectedValue
127127
): void {
128-
$this->scopeConfigMock->method('getValue')
128+
$this->scopeConfigMock
129+
->method('isSetFlag')
130+
->willReturn($useCustomAdminUrl);
131+
132+
$this->scopeConfigMock
133+
->method('getValue')
129134
->willReturnMap(
130135
[
131136
[Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE, null, $url],
@@ -138,7 +143,7 @@ public function testIsHostBackend(
138143
],
139144
[
140145
FrontNameResolver::XML_PATH_CUSTOM_ADMIN_URL,
141-
ScopeInterface::SCOPE_STORE,
146+
ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
142147
null,
143148
$customAdminUrl
144149
]

‎app/code/Magento/Catalog/Block/Widget/Link.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public function getHref()
8181
UrlRewrite::ENTITY_ID => $rewriteData[1],
8282
UrlRewrite::ENTITY_TYPE => $rewriteData[0],
8383
UrlRewrite::STORE_ID => $store->getId(),
84+
UrlRewrite::REDIRECT_TYPE => 0,
8485
];
8586
if (!empty($rewriteData[2]) && $rewriteData[0] == ProductUrlRewriteGenerator::ENTITY_TYPE) {
8687
$filterData[UrlRewrite::METADATA]['category_id'] = $rewriteData[2];

‎app/code/Magento/Catalog/Test/Unit/Block/Widget/LinkTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ function ($route, $params) use ($storeId) {
240240
UrlRewrite::ENTITY_ID => 'entity_id',
241241
UrlRewrite::ENTITY_TYPE => 'entity_type',
242242
UrlRewrite::STORE_ID => $this->storeManager->getStore($storeId)->getStoreId(),
243+
UrlRewrite::REDIRECT_TYPE => 0,
243244
]
244245
)
245246
->willReturn($rewrite);
@@ -319,6 +320,7 @@ public function testGetHrefWithForProductWithCategoryIdParameter()
319320
UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE,
320321
UrlRewrite::STORE_ID => $storeId,
321322
UrlRewrite::METADATA => ['category_id' => 'category_id'],
323+
UrlRewrite::REDIRECT_TYPE => 0,
322324
]
323325
)
324326
->willReturn(false);

‎app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,8 @@ public function getUsedProductIds($product)
552552
{
553553
if (!$product->hasData($this->_usedProductIds)) {
554554
$usedProductIds = [];
555-
foreach ($this->getUsedProducts($product) as $product) {
556-
$usedProductIds[] = $product->getId();
555+
foreach ($this->getUsedProducts($product) as $childProduct) {
556+
$usedProductIds[] = $childProduct->getId();
557557
}
558558
$product->setData($this->_usedProductIds, $usedProductIds);
559559
}

‎app/code/Magento/Customer/Controller/Account/Confirmation.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -99,10 +99,7 @@ public function execute()
9999
);
100100
$this->messageManager->addSuccessMessage(__('Please check your email for confirmation key.'));
101101
return $this->getRedirect('*/*/index', ['_secure' => true]);
102-
} catch (InvalidTransitionException $e) {
103-
$this->messageManager->addSuccessMessage(__('This email does not require confirmation.'));
104-
return $this->getRedirect('*/*/index', ['_secure' => true]);
105-
} catch (NoSuchEntityException $e) {
102+
} catch (InvalidTransitionException | NoSuchEntityException $e) {
106103
$this->messageManager->addErrorMessage(__('Wrong email.'));
107104
}
108105
}

‎app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2011 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\GroupedProduct\Model\Product\Type;
77

@@ -403,7 +403,7 @@ protected function _prepareProduct(\Magento\Framework\DataObject $buyRequest, $p
403403
}
404404
$associatedProducts = !$isStrictProcessMode || !empty($productsInfo)
405405
? $this->getAssociatedProducts($product)
406-
: false;
406+
: [];
407407

408408
foreach ($associatedProducts as $subProduct) {
409409
$qty = $productsInfo[$subProduct->getId()];

‎app/code/Magento/LoginAsCustomerAssistance/view/frontend/layout/customer_account_create.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2020 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
8-
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column"
9-
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
8+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
109
<body>
1110
<referenceBlock name="customer_form_register">
1211
<container name="fieldset.create.info.additional" as="fieldset_create_info_additional"/>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2011 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
8-
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
8+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<update handle="msrp_popup"/>
1010
<body/>
11-
</page>
11+
</page>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2011 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
8-
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
8+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<update handle="msrp_popup"/>
1010
<body/>
1111
</page>

‎app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
22
/**
3-
*
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
3+
* Copyright 2013 Adobe
4+
* All Rights Reserved.
65
*/
76
declare(strict_types=1);
87

@@ -173,7 +172,7 @@ public function execute()
173172
{
174173
if ($this->getRequest()->isPost()
175174
&& $this->getRequest()->getPost('email')
176-
&& $this->newsletterConfig->isActive()
175+
&& $this->newsletterConfig->isActive(ScopeInterface::SCOPE_STORE)
177176
) {
178177
$email = (string)$this->getRequest()->getPost('email');
179178

‎app/code/Magento/Newsletter/view/frontend/layout/customer_account_create.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2011 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
8-
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
8+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<body>
1010
<referenceBlock name="customer_form_register">
1111
<block name="customer.form.register.newsletter" template="Magento_Newsletter::form/register/newsletter.phtml"/>

‎app/code/Magento/SalesRule/Model/Rule/Action/Discount/ByPercent.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\SalesRule\Model\Rule\Action\Discount;
77

@@ -60,12 +60,16 @@ protected function _calculate($rule, $item, $qty, $rulePercent)
6060
$baseItemOriginalPrice = $this->validator->getItemBaseOriginalPrice($item);
6161

6262
$_rulePct = $rulePercent / 100;
63-
$discountData->setAmount(($qty * $itemPrice - $item->getDiscountAmount()) * $_rulePct);
64-
$discountData->setBaseAmount(($qty * $baseItemPrice - $item->getBaseDiscountAmount()) * $_rulePct);
65-
$discountData->setOriginalAmount(($qty * $itemOriginalPrice - $item->getDiscountAmount()) * $_rulePct);
66-
$discountData->setBaseOriginalAmount(
67-
($qty * $baseItemOriginalPrice - $item->getBaseDiscountAmount()) * $_rulePct
68-
);
63+
64+
$amount = ($qty * $itemPrice - $item->getDiscountAmount()) * $_rulePct;
65+
$baseAmount = ($qty * $baseItemPrice - $item->getBaseDiscountAmount()) * $_rulePct;
66+
$originalAmount = ($qty * $itemOriginalPrice - $item->getDiscountAmount()) * $_rulePct;
67+
$baseOriginalAmount = ($qty * $baseItemOriginalPrice - $item->getBaseDiscountAmount()) * $_rulePct;
68+
69+
$discountData->setAmount(round(floatval((string) $amount), 2));
70+
$discountData->setBaseAmount(round(floatval((string) $baseAmount), 2));
71+
$discountData->setOriginalAmount(round(floatval((string) $originalAmount), 2));
72+
$discountData->setBaseOriginalAmount(round(floatval((string) $baseOriginalAmount), 2));
6973

7074
if (!$rule->getDiscountQty() || $rule->getDiscountQty() >= $qty) {
7175
$discountPercent = min(100, $item->getDiscountPercent() + $rulePercent);

‎app/code/Magento/SalesRule/Test/Unit/Model/Rule/Action/Discount/ToPercentTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -221,8 +221,8 @@ public static function calculateDataProvider()
221221
'expectedRuleDiscountQty' => 100,
222222
'expectedDiscountData' => [
223223
'amount' => 98,
224-
'baseAmount' => 59.49999999999999,
225-
'originalAmount' => 118.99999999999999,
224+
'baseAmount' => 59.50,
225+
'originalAmount' => 119,
226226
'baseOriginalAmount' => 80.5,
227227
],
228228
]

‎app/code/Magento/Sitemap/view/frontend/layout/robots_index_index.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2017 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
8-
<page layout="robots" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
8+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<body>
1010
<referenceContainer name="root">
1111
<block class="Magento\Sitemap\Block\Robots" name="sitemapRobotsLinks"/>

‎app/code/Magento/VaultGraphQl/Model/Resolver/DeletePaymentToken.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2018 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -21,26 +21,14 @@
2121
*/
2222
class DeletePaymentToken implements ResolverInterface
2323
{
24-
/**
25-
* @var PaymentTokenManagementInterface
26-
*/
27-
private $paymentTokenManagement;
28-
29-
/**
30-
* @var PaymentTokenRepositoryInterface
31-
*/
32-
private $paymentTokenRepository;
33-
3424
/**
3525
* @param PaymentTokenManagementInterface $paymentTokenManagement
3626
* @param PaymentTokenRepositoryInterface $paymentTokenRepository
3727
*/
3828
public function __construct(
39-
PaymentTokenManagementInterface $paymentTokenManagement,
40-
PaymentTokenRepositoryInterface $paymentTokenRepository
29+
private readonly PaymentTokenManagementInterface $paymentTokenManagement,
30+
private readonly PaymentTokenRepositoryInterface $paymentTokenRepository
4131
) {
42-
$this->paymentTokenManagement = $paymentTokenManagement;
43-
$this->paymentTokenRepository = $paymentTokenRepository;
4432
}
4533

4634
/**

‎app/code/Magento/VaultGraphQl/Model/Resolver/PaymentTokens.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2017 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -19,18 +19,12 @@
1919
*/
2020
class PaymentTokens implements ResolverInterface
2121
{
22-
/**
23-
* @var PaymentTokenManagement
24-
*/
25-
private $paymentTokenManagement;
26-
2722
/**
2823
* @param PaymentTokenManagement $paymentTokenManagement
2924
*/
3025
public function __construct(
31-
PaymentTokenManagement $paymentTokenManagement
26+
private readonly PaymentTokenManagement $paymentTokenManagement
3227
) {
33-
$this->paymentTokenManagement = $paymentTokenManagement;
3428
}
3529

3630
/**

0 commit comments

Comments
 (0)