Skip to content

Commit 1ff6e0f

Browse files
committed
#21394: Static test fix.
1 parent 1e55b13 commit 1ff6e0f

File tree

2 files changed

+104
-64
lines changed

2 files changed

+104
-64
lines changed

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

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -652,15 +652,17 @@ public function initiatePasswordReset($email, $template, $websiteId = null)
652652
*/
653653
private function handleUnknownTemplate($template)
654654
{
655-
throw new InputException(__(
656-
'Invalid value of "%value" provided for the %fieldName field. Possible values: %template1 or %template2.',
657-
[
658-
'value' => $template,
659-
'fieldName' => 'template',
660-
'template1' => AccountManagement::EMAIL_REMINDER,
661-
'template2' => AccountManagement::EMAIL_RESET
662-
]
663-
));
655+
throw new InputException(
656+
__(
657+
'Invalid value of "%value" provided for the %fieldName field. Possible values: %template1 or %template2.',
658+
[
659+
'value' => $template,
660+
'fieldName' => 'template',
661+
'template1' => AccountManagement::EMAIL_REMINDER,
662+
'template2' => AccountManagement::EMAIL_RESET
663+
]
664+
)
665+
);
664666
}
665667

666668
/**
@@ -1314,13 +1316,20 @@ protected function sendEmailTemplate(
13141316
}
13151317

13161318
$transport = $this->transportBuilder->setTemplateIdentifier($templateId)
1317-
->setTemplateOptions(['area' => Area::AREA_FRONTEND, 'store' => $storeId])
1319+
->setTemplateOptions(
1320+
[
1321+
'area' => Area::AREA_FRONTEND,
1322+
'store' => $storeId
1323+
]
1324+
)
13181325
->setTemplateVars($templateParams)
1319-
->setFrom($this->scopeConfig->getValue(
1320-
$sender,
1321-
ScopeInterface::SCOPE_STORE,
1322-
$storeId
1323-
))
1326+
->setFrom(
1327+
$this->scopeConfig->getValue(
1328+
$sender,
1329+
ScopeInterface::SCOPE_STORE,
1330+
$storeId
1331+
)
1332+
)
13241333
->addTo($email, $this->customerViewHelper->getCustomerName($customer))
13251334
->getTransport();
13261335

dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php

Lines changed: 80 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,13 @@ public function testWithConfirmCreatePostAction()
315315
$this->dispatch('customer/account/createPost');
316316
$this->assertRedirect($this->stringContains('customer/account/index/'));
317317
$this->assertSessionMessages(
318-
$this->equalTo([
319-
'You must confirm your account. Please check your email for the confirmation link or '
318+
$this->equalTo(
319+
[
320+
'You must confirm your account. Please check your email for the confirmation link or '
320321
. '<a href="http://localhost/index.php/customer/account/confirmation/'
321322
. '?email=test2%40email.com">click here</a> for a new link.'
322-
]),
323+
]
324+
),
323325
MessageInterface::TYPE_SUCCESS
324326
);
325327
}
@@ -333,10 +335,14 @@ public function testExistingEmailCreatePostAction()
333335
$this->dispatch('customer/account/createPost');
334336
$this->assertRedirect($this->stringContains('customer/account/create/'));
335337
$this->assertSessionMessages(
336-
$this->equalTo(['There is already an account with this email address. ' .
337-
'If you are sure that it is your email address, ' .
338-
'<a href="http://localhost/index.php/customer/account/forgotpassword/">click here</a>' .
339-
' to get your password and access your account.', ]),
338+
$this->equalTo(
339+
[
340+
'There is already an account with this email address. ' .
341+
'If you are sure that it is your email address, ' .
342+
'<a href="http://localhost/index.php/customer/account/forgotpassword/">click here</a>' .
343+
' to get your password and access your account.',
344+
]
345+
),
340346
MessageInterface::TYPE_ERROR
341347
);
342348
}
@@ -348,7 +354,11 @@ public function testInactiveUserConfirmationAction()
348354
{
349355
$this->getRequest()
350356
->setMethod('POST')
351-
->setPostValue(['email' => 'customer@needAconfirmation.com']);
357+
->setPostValue(
358+
[
359+
'email' => 'customer@needAconfirmation.com',
360+
]
361+
);
352362

353363
$this->dispatch('customer/account/confirmation');
354364
$this->assertRedirect($this->stringContains('customer/account/index'));
@@ -365,14 +375,20 @@ public function testActiveUserConfirmationAction()
365375
{
366376
$this->getRequest()
367377
->setMethod('POST')
368-
->setPostValue([
369-
'email' => 'customer@example.com',
370-
]);
378+
->setPostValue(
379+
[
380+
'email' => 'customer@example.com',
381+
]
382+
);
371383

372384
$this->dispatch('customer/account/confirmation');
373385
$this->assertRedirect($this->stringContains('customer/account/index'));
374386
$this->assertSessionMessages(
375-
$this->equalTo(['This email does not require confirmation.']),
387+
$this->equalTo(
388+
[
389+
'This email does not require confirmation.',
390+
]
391+
),
376392
MessageInterface::TYPE_SUCCESS
377393
);
378394
}
@@ -413,9 +429,11 @@ public function testForgotPasswordPostWithBadEmailAction()
413429
{
414430
$this->getRequest()->setMethod(HttpRequest::METHOD_POST);
415431
$this->getRequest()
416-
->setPostValue([
417-
'email' => 'bad@email',
418-
]);
432+
->setPostValue(
433+
[
434+
'email' => 'bad@email',
435+
]
436+
);
419437

420438
$this->dispatch('customer/account/forgotPasswordPost');
421439
$this->assertRedirect($this->stringContains('customer/account/forgotpassword'));
@@ -434,10 +452,12 @@ public function testResetPasswordPostNoTokenAction()
434452
->setParam('id', 1)
435453
->setParam('token', '8ed8677e6c79e68b94e61658bd756ea5')
436454
->setMethod('POST')
437-
->setPostValue([
438-
'password' => 'new-password',
439-
'password_confirmation' => 'new-password',
440-
]);
455+
->setPostValue(
456+
[
457+
'password' => 'new-password',
458+
'password_confirmation' => 'new-password',
459+
]
460+
);
441461

442462
$this->dispatch('customer/account/resetPasswordPost');
443463
$this->assertRedirect($this->stringContains('customer/account/'));
@@ -457,10 +477,12 @@ public function testResetPasswordPostAction()
457477
->setQueryValue('id', 1)
458478
->setQueryValue('token', '8ed8677e6c79e68b94e61658bd756ea5')
459479
->setMethod('POST')
460-
->setPostValue([
461-
'password' => 'new-Password1',
462-
'password_confirmation' => 'new-Password1',
463-
]);
480+
->setPostValue(
481+
[
482+
'password' => 'new-Password1',
483+
'password_confirmation' => 'new-Password1',
484+
]
485+
);
464486

465487
$this->dispatch('customer/account/resetPasswordPost');
466488
$this->assertRedirect($this->stringContains('customer/account/login'));
@@ -483,8 +505,11 @@ public function testEditAction()
483505
$this->assertEquals(200, $this->getResponse()->getHttpResponseCode(), $body);
484506
$this->assertContains('<div class="field field-name-firstname required">', $body);
485507
// Verify the password check box is not checked
486-
$this->assertContains('<input type="checkbox" name="change_password" id="change-password" '
487-
. 'data-role="change-password" value="1" title="Change&#x20;Password" class="checkbox" />', $body);
508+
$this->assertContains(
509+
'<input type="checkbox" name="change_password" id="change-password" '
510+
. 'data-role="change-password" value="1" title="Change&#x20;Password" class="checkbox" />',
511+
$body
512+
);
488513
}
489514

490515
/**
@@ -528,14 +553,16 @@ public function testEditPostAction()
528553
$this->login(1);
529554
$this->getRequest()
530555
->setMethod('POST')
531-
->setPostValue([
532-
'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(),
533-
'firstname' => 'John',
534-
'lastname' => 'Doe',
535-
'email' => 'johndoe@email.com',
536-
'change_email' => 1,
537-
'current_password' => 'password'
538-
]);
556+
->setPostValue(
557+
[
558+
'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(),
559+
'firstname' => 'John',
560+
'lastname' => 'Doe',
561+
'email' => 'johndoe@email.com',
562+
'change_email' => 1,
563+
'current_password' => 'password'
564+
]
565+
);
539566

540567
$this->dispatch('customer/account/editPost');
541568

@@ -666,16 +693,18 @@ public function testWrongConfirmationEditPostAction()
666693
$this->login(1);
667694
$this->getRequest()
668695
->setMethod('POST')
669-
->setPostValue([
670-
'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(),
671-
'firstname' => 'John',
672-
'lastname' => 'Doe',
673-
'email' => 'johndoe@email.com',
674-
'change_password' => 1,
675-
'current_password' => 'password',
676-
'password' => 'new-password',
677-
'password_confirmation' => 'new-password-no-match',
678-
]);
696+
->setPostValue(
697+
[
698+
'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(),
699+
'firstname' => 'John',
700+
'lastname' => 'Doe',
701+
'email' => 'johndoe@email.com',
702+
'change_password' => 1,
703+
'current_password' => 'password',
704+
'password' => 'new-password',
705+
'password_confirmation' => 'new-password-no-match',
706+
]
707+
);
679708

680709
$this->dispatch('customer/account/editPost');
681710

@@ -859,13 +888,15 @@ private function getCustomerByEmail($email)
859888
*/
860889
private function prepareRequest()
861890
{
862-
$post = new Parameters([
863-
'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(),
864-
'login' => [
865-
'username' => 'customer@example.com',
866-
'password' => 'password'
891+
$post = new Parameters(
892+
[
893+
'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(),
894+
'login' => [
895+
'username' => 'customer@example.com',
896+
'password' => 'password'
897+
]
867898
]
868-
]);
899+
);
869900
$request = $this->getRequest();
870901
$formKey = $this->_objectManager->get(FormKey::class);
871902
$request->setParam('form_key', $formKey->getFormKey());

0 commit comments

Comments
 (0)