Skip to content

Commit ba4e292

Browse files
committed
[User] Refactor and Unit Test Coverage for class \Magento\User\Model\Backend\Config\ObserverConfig
1 parent 6552f8f commit ba4e292

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

app/code/Magento/User/Test/Unit/Model/Backend/Config/ObserverConfigTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,28 @@ protected function setUp()
6363
);
6464
}
6565

66+
/**
67+
* Test when admin password lifetime = 0 days
68+
*/
69+
public function testIsLatestPasswordExpiredWhenNoAdminLifeTime()
70+
{
71+
$this->backendConfigMock->expects(self::any())->method('getValue')
72+
->with(self::XML_ADMIN_SECURITY_PASSWORD_LIFETIME)
73+
->willReturn('0');
74+
$this->assertEquals(false, $this->model->_isLatestPasswordExpired([]));
75+
}
76+
77+
/**
78+
* Test when admin password lifetime = 2 days
79+
*/
80+
public function testIsLatestPasswordExpiredWhenHasAdminLifeTime()
81+
{
82+
$this->backendConfigMock->expects(self::any())->method('getValue')
83+
->with(self::XML_ADMIN_SECURITY_PASSWORD_LIFETIME)
84+
->willReturn('2');
85+
$this->assertEquals(true, $this->model->_isLatestPasswordExpired(['last_updated' => 1571428052]));
86+
}
87+
6688
/**
6789
* Test when security lockout threshold = 100 minutes
6890
*/

0 commit comments

Comments
 (0)