Skip to content

Commit 5fd9cc2

Browse files
committed
Fixes according to review
1 parent a2d0302 commit 5fd9cc2

File tree

7 files changed

+43
-19
lines changed

7 files changed

+43
-19
lines changed

app/code/Magento/Catalog/Helper/Output.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function categoryAttribute($category, $attributeHtml, $attributeName)
219219
if ($attributeHtml !== null
220220
&& $attribute->getIsHtmlAllowedOnFront()
221221
&& $attribute->getIsWysiwygEnabled()
222-
&& $this->isDirectivesExists($attributeHtml)
222+
&& $this->isDirectivesExists((string)$attributeHtml)
223223

224224
) {
225225
$attributeHtml = $this->_getTemplateProcessor()->filter($attributeHtml);
@@ -238,7 +238,7 @@ public function categoryAttribute($category, $attributeHtml, $attributeName)
238238
* @param string $attributeHtml
239239
* @return bool
240240
*/
241-
public function isDirectivesExists($attributeHtml)
241+
public function isDirectivesExists(string $attributeHtml): bool
242242
{
243243
$matches = false;
244244
foreach ($this->directivePatterns as $pattern) {

app/code/Magento/Customer/Controller/Account/LoginPost.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,11 @@ public function execute()
204204
return $resultRedirect;
205205
}
206206
} catch (EmailNotConfirmedException $e) {
207-
$value = $this->customerUrl->getEmailConfirmationUrl($login['username']);
208-
$message = __(
209-
'This account is not confirmed. <a href="%1">Click here</a> to resend confirmation email.',
210-
$value
207+
$this->messageManager->addComplexErrorMessage(
208+
'confirmAccountErrorMessage',
209+
['url' => $this->customerUrl->getEmailConfirmationUrl($login['username'])]
211210
);
211+
$this->session->setUsername($login['username']);
212212
} catch (AuthenticationException $e) {
213213
$message = __(
214214
'The account sign-in was incorrect or your account is disabled temporarily. '
@@ -223,7 +223,7 @@ public function execute()
223223
);
224224
} finally {
225225
if (isset($message)) {
226-
$this->messageManager->addError($message);
226+
$this->messageManager->addErrorMessage($message);
227227
$this->session->setUsername($login['username']);
228228
}
229229
}

app/code/Magento/Customer/Test/Unit/Controller/Account/LoginPostTest.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -551,14 +551,12 @@ protected function mockExceptions($exception, $username)
551551
->with($username)
552552
->willReturn($url);
553553

554-
$message = __(
555-
'This account is not confirmed.' .
556-
' <a href="%1">Click here</a> to resend confirmation email.',
557-
$url
558-
);
559554
$this->messageManager->expects($this->once())
560-
->method('addError')
561-
->with($message)
555+
->method('addComplexErrorMessage')
556+
->with(
557+
'confirmAccountErrorMessage',
558+
['url' => $url]
559+
)
562560
->willReturnSelf();
563561

564562
$this->session->expects($this->once())
@@ -569,7 +567,7 @@ protected function mockExceptions($exception, $username)
569567

570568
case \Magento\Framework\Exception\AuthenticationException::class:
571569
$this->messageManager->expects($this->once())
572-
->method('addError')
570+
->method('addErrorMessage')
573571
->with(
574572
__(
575573
'The account sign-in was incorrect or your account is disabled temporarily. '
@@ -597,7 +595,7 @@ protected function mockExceptions($exception, $username)
597595
. 'Please wait and try again later.'
598596
);
599597
$this->messageManager->expects($this->once())
600-
->method('addError')
598+
->method('addErrorMessage')
601599
->with($message)
602600
->willReturnSelf();
603601
$this->session->expects($this->once())

app/code/Magento/Customer/etc/frontend/di.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@
9292
<item name="template" xsi:type="string">Magento_Customer::messages/confirmAccountSuccessMessage.phtml</item>
9393
</item>
9494
</item>
95+
<item name="confirmAccountErrorMessage" xsi:type="array">
96+
<item name="renderer" xsi:type="const">\Magento\Framework\View\Element\Message\Renderer\BlockRenderer::CODE</item>
97+
<item name="data" xsi:type="array">
98+
<item name="template" xsi:type="string">Magento_Customer::messages/confirmAccountErrorMessage.phtml</item>
99+
</item>
100+
</item>
95101
<item name="customerVatShippingAddressSuccessMessage" xsi:type="array">
96102
<item name="renderer" xsi:type="const">\Magento\Framework\View\Element\Message\Renderer\BlockRenderer::CODE</item>
97103
<item name="data" xsi:type="array">
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/** @var \Magento\Framework\View\Element\Template $block */
8+
/** @var \Magento\Framework\Escaper $escaper */
9+
10+
?>
11+
<?= $escaper->escapeHtml(__('This account is not confirmed. <a href="%1">Click here</a> to resend confirmation email.', $block->getData('url')), ['a']);

dev/tests/integration/testsuite/Magento/Catalog/Helper/OutputTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ protected function _testAttribute($method, $entityCode, $expectedResult)
122122
try {
123123
$this->assertEquals(
124124
$expectedResult,
125-
$this->_helper->{$method}(uniqid(), "<p>line1</p>\nline2", $attributeName)
125+
$this->_helper->{$method}(uniqid(), __("<p>line1</p>\nline2"), $attributeName)
126126
);
127127

128128
$attribute->setIsHtmlAllowedOnFront($isHtml)->setIsWysiwygEnabled($isWysiwyg);

dev/tests/integration/testsuite/Magento/Customer/Controller/Account/LoginPostTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ class LoginPostTest extends AbstractController
2828
/** @var EncoderInterface */
2929
private $urlEncoder;
3030

31+
/**
32+
* @var Url
33+
*/
34+
private $customerUrl;
35+
3136
/**
3237
* @inheritdoc
3338
*/
@@ -37,6 +42,7 @@ protected function setUp()
3742

3843
$this->session = $this->_objectManager->get(Session::class);
3944
$this->urlEncoder = $this->_objectManager->get(EncoderInterface::class);
45+
$this->customerUrl = $this->_objectManager->get(Url::class);
4046
}
4147

4248
/**
@@ -107,13 +113,16 @@ public function missingParametersDataProvider(): array
107113
*/
108114
public function testLoginWithUnconfirmedPassword(): void
109115
{
110-
$this->markTestSkipped('Blocked by MC-31370.');
111116
$email = 'unconfirmedcustomer@example.com';
112117
$this->prepareRequest($email, 'Qwert12345');
113118
$this->dispatch('customer/account/loginPost');
114119
$this->assertEquals($email, $this->session->getUsername());
120+
$message = __(
121+
'This account is not confirmed. <a href="%1">Click here</a> to resend confirmation email.',
122+
$this->customerUrl->getEmailConfirmationUrl($this->session->getUsername())
123+
);
115124
$this->assertSessionMessages(
116-
$this->equalTo([(string)__('This account is not confirmed. Click here to resend confirmation email.')]),
125+
$this->equalTo([(string)$message]),
117126
MessageInterface::TYPE_ERROR
118127
);
119128
}

0 commit comments

Comments
 (0)