Skip to content

Commit 13038fc

Browse files
committed
fix unit test (#22833: Short-term admin accounts)
1 parent 581ace6 commit 13038fc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/code/Magento/Security/Test/Unit/Observer/BeforeAdminUserAuthenticateTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function testWithExpiredUser()
9595
->method('userIsExpired')
9696
->with($this->userMock)
9797
->willReturn(true);
98-
$this->userMock->expects(static::once())->method('getId')->willReturn($adminUserId);
98+
$this->userMock->expects(static::exactly(2))->method('getId')->willReturn($adminUserId);
9999
$this->userExpirationManagerMock->expects(static::once())
100100
->method('deactivateExpiredUsers')
101101
->with([$adminUserId])
@@ -105,11 +105,12 @@ public function testWithExpiredUser()
105105

106106
public function testWithNonExpiredUser()
107107
{
108+
$adminUserId = 123;
108109
$username = 'testuser';
109110
$this->eventObserverMock->expects(static::once())->method('getEvent')->willReturn($this->eventMock);
110111
$this->eventMock->expects(static::once())->method('getUsername')->willReturn($username);
111112
$this->userMock->expects(static::once())->method('loadByUsername')->willReturn($this->userMock);
112-
113+
$this->userMock->expects(static::once())->method('getId')->willReturn($adminUserId);
113114
$this->userExpirationManagerMock->expects(static::once())
114115
->method('userIsExpired')
115116
->with($this->userMock)

0 commit comments

Comments
 (0)