Skip to content

Commit b97490c

Browse files
ENGCOM-7565: replaced deprecated addWarning method with addWarningMessage method … #28264
- Merge Pull Request #28264 from kishorekumarkesavan/magento2:replace-addWarning-deprecated - Merged commits: 1. 6a69a8f 2. 877a017
2 parents dc14e50 + 877a017 commit b97490c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/code/Magento/Security/Model/Plugin/Auth.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public function __construct(
3535
}
3636

3737
/**
38+
* Add warning message if other sessions terminated
39+
*
3840
* @param \Magento\Backend\Model\Auth $authModel
3941
* @return void
4042
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
@@ -43,11 +45,13 @@ public function afterLogin(\Magento\Backend\Model\Auth $authModel)
4345
{
4446
$this->sessionsManager->processLogin();
4547
if ($this->sessionsManager->getCurrentSession()->isOtherSessionsTerminated()) {
46-
$this->messageManager->addWarning(__('All other open sessions for this account were terminated.'));
48+
$this->messageManager->addWarningMessage(__('All other open sessions for this account were terminated.'));
4749
}
4850
}
4951

5052
/**
53+
* Handle logout process
54+
*
5155
* @param \Magento\Backend\Model\Auth $authModel
5256
* @return void
5357
* @SuppressWarnings(PHPMD.UnusedFormalParameter)

app/code/Magento/Security/Test/Unit/Model/Plugin/AuthTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function setUp(): void
6464

6565
$this->messageManager = $this->getMockForAbstractClass(
6666
ManagerInterface::class,
67-
['addWarning'],
67+
['addWarningMessage'],
6868
'',
6969
false
7070
);
@@ -100,7 +100,7 @@ public function testAfterLogin()
100100
->method('isOtherSessionsTerminated')
101101
->willReturn(true);
102102
$this->messageManager->expects($this->once())
103-
->method('addWarning')
103+
->method('addWarningMessage')
104104
->with($warningMessage);
105105

106106
$this->model->afterLogin($this->authMock);

0 commit comments

Comments
 (0)