Skip to content

Commit 62b8f8a

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop
Accepted Community Pull Requests: - #24783: #23295: Reset Password Confirmation Link Email Not St� (by @kisroman) - #24761: Resolved Issue #24740 (by @drpayyne) - #24754: Magento_CurrencySymbol module. Replace replace deprecated message functions (by @atwixfirster) - #24753: Fixed swatch-renderer js console error on edit cart product (by @ravi-chandra3197) - #24755: Fix for CLI Backup doesn't work properly when directory is a symlink … (by @ivan-koliadynskyy) Fixed GitHub Issues: - #23295: Reset Password Confirmation Link Email Not Store Scoped For Global Customers (reported by @floorz) has been fixed in #24783 by @kisroman in 2.3-develop branch Related commits: 1. 35ad339 - #24740: Change text and check box not in same aligned (reported by @bhavik43) has been fixed in #24761 by @drpayyne in 2.3-develop branch Related commits: 1. be1194b - #13218: CLI Backup doesn't work properly when directory is a symlink (reported by @Igloczek) has been fixed in #24755 by @ivan-koliadynskyy in 2.3-develop branch Related commits: 1. b27a576 2. 7a9f956
2 parents 15ee950 + 60ca65e commit 62b8f8a

File tree

12 files changed

+149
-36
lines changed

12 files changed

+149
-36
lines changed

app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency/FetchRates.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
@@ -13,6 +12,9 @@
1312
use Magento\Framework\Controller\ResultFactory;
1413
use Magento\CurrencySymbol\Controller\Adminhtml\System\Currency as CurrencyAction;
1514

15+
/**
16+
* Class FetchRates
17+
*/
1618
class FetchRates extends CurrencyAction implements HttpGetActionInterface, HttpPostActionInterface
1719
{
1820
/**
@@ -41,20 +43,20 @@ public function execute()
4143
}
4244
$rates = $importModel->fetchRates();
4345
$errors = $importModel->getMessages();
44-
if (sizeof($errors) > 0) {
46+
if (count($errors) > 0) {
4547
foreach ($errors as $error) {
46-
$this->messageManager->addWarning($error);
48+
$this->messageManager->addWarningMessage($error);
4749
}
48-
$this->messageManager->addWarning(
50+
$this->messageManager->addWarningMessage(
4951
__('Click "Save" to apply the rates we found.')
5052
);
5153
} else {
52-
$this->messageManager->addSuccess(__('Click "Save" to apply the rates we found.'));
54+
$this->messageManager->addSuccessMessage(__('Click "Save" to apply the rates we found.'));
5355
}
5456

5557
$backendSession->setRates($rates);
5658
} catch (\Exception $e) {
57-
$this->messageManager->addError($e->getMessage());
59+
$this->messageManager->addErrorMessage($e->getMessage());
5860
}
5961

6062
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */

app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency/SaveRates.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
@@ -9,6 +8,9 @@
98

109
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
1110

11+
/**
12+
* Class SaveRates
13+
*/
1214
class SaveRates extends \Magento\CurrencySymbol\Controller\Adminhtml\System\Currency implements HttpPostActionInterface
1315
{
1416
/**
@@ -23,22 +25,23 @@ public function execute()
2325
try {
2426
foreach ($data as $currencyCode => $rate) {
2527
foreach ($rate as $currencyTo => $value) {
26-
$value = abs($this->_objectManager->get(
27-
\Magento\Framework\Locale\FormatInterface::class
28-
)->getNumber($value));
28+
$value = abs(
29+
$this->_objectManager->get(\Magento\Framework\Locale\FormatInterface::class)
30+
->getNumber($value)
31+
);
2932
$data[$currencyCode][$currencyTo] = $value;
3033
if ($value == 0) {
31-
$this->messageManager->addWarning(
34+
$this->messageManager->addWarningMessage(
3235
__('Please correct the input data for "%1 => %2" rate.', $currencyCode, $currencyTo)
3336
);
3437
}
3538
}
3639
}
3740

3841
$this->_objectManager->create(\Magento\Directory\Model\Currency::class)->saveRates($data);
39-
$this->messageManager->addSuccess(__('All valid rates have been saved.'));
42+
$this->messageManager->addSuccessMessage(__('All valid rates have been saved.'));
4043
} catch (\Exception $e) {
41-
$this->messageManager->addError($e->getMessage());
44+
$this->messageManager->addErrorMessage($e->getMessage());
4245
}
4346
}
4447

app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol/Save.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\CurrencySymbol\Controller\Adminhtml\System\Currencysymbol;
87

98
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
109

10+
/**
11+
* Class Save
12+
*/
1113
class Save extends \Magento\CurrencySymbol\Controller\Adminhtml\System\Currencysymbol implements HttpPostActionInterface
1214
{
1315
/**
@@ -29,9 +31,9 @@ public function execute()
2931
try {
3032
$this->_objectManager->create(\Magento\CurrencySymbol\Model\System\Currencysymbol::class)
3133
->setCurrencySymbolsData($symbolsDataArray);
32-
$this->messageManager->addSuccess(__('You applied the custom currency symbols.'));
34+
$this->messageManager->addSuccessMessage(__('You applied the custom currency symbols.'));
3335
} catch (\Exception $e) {
34-
$this->messageManager->addError($e->getMessage());
36+
$this->messageManager->addErrorMessage($e->getMessage());
3537
}
3638

3739
$this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*')));
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CurrencySymbol\Test\Unit\Controller\Adminhtml\System\Currency;
7+
8+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
9+
10+
/**
11+
* Class SaveRatesTest
12+
*/
13+
class SaveRatesTest extends \PHPUnit\Framework\TestCase
14+
{
15+
/**
16+
* @var \Magento\CurrencySymbol\Controller\Adminhtml\System\Currency\SaveRates
17+
*/
18+
protected $action;
19+
20+
/**
21+
* @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject
22+
*/
23+
protected $requestMock;
24+
25+
/**
26+
* @var \Magento\Framework\App\ResponseInterface|\PHPUnit_Framework_MockObject_MockObject
27+
*/
28+
protected $responseMock;
29+
30+
/**
31+
*
32+
*/
33+
protected function setUp()
34+
{
35+
$objectManager = new ObjectManager($this);
36+
37+
$this->requestMock = $this->createMock(\Magento\Framework\App\RequestInterface::class);
38+
39+
$this->responseMock = $this->createPartialMock(
40+
\Magento\Framework\App\ResponseInterface::class,
41+
['setRedirect', 'sendResponse']
42+
);
43+
44+
$this->action = $objectManager->getObject(
45+
\Magento\CurrencySymbol\Controller\Adminhtml\System\Currency\SaveRates::class,
46+
[
47+
'request' => $this->requestMock,
48+
'response' => $this->responseMock,
49+
]
50+
);
51+
}
52+
53+
/**
54+
*
55+
*/
56+
public function testWithNullRateExecute()
57+
{
58+
$this->requestMock->expects($this->once())
59+
->method('getParam')
60+
->with('rate')
61+
->willReturn(null);
62+
63+
$this->responseMock->expects($this->once())->method('setRedirect');
64+
65+
$this->action->execute();
66+
}
67+
}

app/code/Magento/CurrencySymbol/Test/Unit/Controller/Adminhtml/System/Currencysymbol/SaveTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function testExecute()
128128
->willReturn($this->filterManagerMock);
129129

130130
$this->messageManagerMock->expects($this->once())
131-
->method('addSuccess')
131+
->method('addSuccessMessage')
132132
->with(__('You applied the custom currency symbols.'));
133133

134134
$this->action->execute();

app/code/Magento/Customer/Model/EmailNotification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ public function passwordReminder(CustomerInterface $customer)
340340
*/
341341
public function passwordResetConfirmation(CustomerInterface $customer)
342342
{
343-
$storeId = $this->storeManager->getStore()->getId();
343+
$storeId = $customer->getStoreId();
344344
if (!$storeId) {
345345
$storeId = $this->getWebsiteStoreId($customer);
346346
}

app/code/Magento/Customer/Test/Unit/Model/EmailNotificationTest.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ public function testPasswordResetConfirmation()
521521

522522
/** @var CustomerInterface|\PHPUnit_Framework_MockObject_MockObject $customer */
523523
$customer = $this->createMock(CustomerInterface::class);
524-
$customer->expects($this->any())
524+
$customer->expects($this->once())
525525
->method('getStoreId')
526526
->willReturn($customerStoreId);
527527
$customer->expects($this->any())
@@ -539,11 +539,6 @@ public function testPasswordResetConfirmation()
539539
->method('getStore')
540540
->willReturn($this->storeMock);
541541

542-
$this->storeManagerMock->expects($this->at(1))
543-
->method('getStore')
544-
->with($customerStoreId)
545-
->willReturn($this->storeMock);
546-
547542
$this->customerRegistryMock->expects($this->once())
548543
->method('retrieveSecureData')
549544
->with($customerId)

app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,10 @@ define([
12651265
dataMergeStrategy: this.options.gallerySwitchStrategy
12661266
});
12671267
}
1268-
gallery.first();
1268+
1269+
if (gallery) {
1270+
gallery.first();
1271+
}
12691272
} else if (justAnImage && justAnImage.img) {
12701273
context.find('.product-image-photo').attr('src', justAnImage.img);
12711274
}

app/design/adminhtml/Magento/backend/web/css/source/forms/_fields.less

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
> .admin__field-control {
123123
#mix-grid .column(@field-control-grid__column, @field-grid__columns);
124124
input[type="checkbox"] {
125-
margin-top: @indent__s;
125+
margin-top: 0;
126126
}
127127
}
128128

@@ -156,7 +156,7 @@
156156
.admin__field {
157157
margin-top: 8px;
158158
}
159-
}
159+
}
160160
}
161161
}
162162
&.composite-bundle {
@@ -307,7 +307,7 @@
307307
.admin__fieldset > & {
308308
margin-bottom: 3rem;
309309
position: relative;
310-
310+
311311
&.field-import_file {
312312
.input-file {
313313
margin-top: 6px;
@@ -664,7 +664,7 @@
664664
display: inline-block;
665665
}
666666
}
667-
667+
668668

669669
+ .admin__field:last-child {
670670
width: auto;
@@ -700,7 +700,7 @@
700700
width: 100%;
701701
}
702702
}
703-
& > .admin__field-label {
703+
& > .admin__field-label {
704704
text-align: left;
705705
}
706706

dev/tests/integration/testsuite/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency/FetchRatesTest.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,30 @@
66

77
namespace Magento\CurrencySymbol\Controller\Adminhtml\System\Currency;
88

9+
use Magento\Framework\Escaper;
10+
911
/**
1012
* Fetch Rates Test
1113
*/
1214
class FetchRatesTest extends \Magento\TestFramework\TestCase\AbstractBackendController
1315
{
16+
/**
17+
* @var Escaper
18+
*/
19+
private $escaper;
20+
21+
/**
22+
* Initial setup
23+
*/
24+
protected function setUp()
25+
{
26+
$this->escaper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
27+
Escaper::class
28+
);
29+
30+
parent::setUp();
31+
}
32+
1433
/**
1534
* Test fetch action without service
1635
*
@@ -46,7 +65,11 @@ public function testFetchRatesActionWithNonexistentService(): void
4665
$this->dispatch('backend/admin/system_currency/fetchRates');
4766

4867
$this->assertSessionMessages(
49-
$this->contains("The import model can't be initialized. Verify the model and try again."),
68+
$this->contains(
69+
$this->escaper->escapeHtml(
70+
"The import model can't be initialized. Verify the model and try again."
71+
)
72+
),
5073
\Magento\Framework\Message\MessageInterface::TYPE_ERROR
5174
);
5275
}

0 commit comments

Comments
 (0)