36 $this->scopeConfigMock = $this->createPartialMock(
37 \
Magento\Framework\
App\Config\ScopeConfigInterface::class,
38 [
'getValue',
'isSetFlag']
41 $this->scopeMock = $this->createMock(\
Magento\Framework\Config\ScopeInterface::class);
43 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
45 \
Magento\Security\Model\Config::class,
47 'scopeConfig' => $this->scopeConfigMock,
48 'scope' => $this->scopeMock
56 \
Magento\Security\Model\Config::LIMITATION_TIME_PERIOD,
57 $this->model->getLimitationTimePeriod()
68 $this->scopeConfigMock->expects($this->once())
71 \
Magento\Security\Model\Config::XML_PATH_EMAIL_RECIPIENT,
72 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE
77 $this->assertEquals(
$email, $this->model->getCustomerServiceEmail());
87 $this->scopeConfigMock->expects($this->once())
89 ->with(\
Magento\Backend\Model\Auth\Session::XML_PATH_SESSION_LIFETIME)
91 $this->returnValue($lifetime)
93 $this->assertEquals($lifetime, $this->model->getAdminSessionLifetime());
102 $this->scopeConfigMock->expects($this->once())
103 ->method(
'isSetFlag')
104 ->with(\
Magento\Security\Model\Config::XML_PATH_ADMIN_ACCOUNT_SHARING)
106 $this->returnValue($isShared)
108 $this->assertEquals($isShared, $this->model->isAdminAccountSharingEnabled());
116 return [[
true], [
false]];
126 $this->scopeConfigMock->expects($this->once())
130 . \
Magento\Security\Model\Config::XML_PATH_PASSWORD_RESET_PROTECTION_TYPE
132 ->willReturn($resetMethod);
133 $this->scopeMock->expects($this->once())
134 ->method(
'getCurrentScope')
135 ->willReturn($scope);
136 $this->assertEquals($resetMethod, $this->model->getPasswordResetProtectionType($scope));
144 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
146 \
Magento\Security\Model\Config\Source\ResetMethod::class
149 $optionKeys = array_keys($resetMethodSource->toArray());
151 foreach ($optionKeys as $key) {
167 if ($scope == \
Magento\Framework\
App\Area::AREA_ADMINHTML) {
168 return \Magento\Security\Model\Config::XML_PATH_ADMIN_AREA;
170 return \Magento\Security\Model\Config::XML_PATH_FRONTEND_AREA;
180 $this->scopeConfigMock->expects($this->once())
184 . \
Magento\Security\Model\Config::XML_PATH_MAX_NUMBER_PASSWORD_RESET_REQUESTS
186 ->willReturn($limitNumber);
187 $this->scopeMock->expects($this->once())
188 ->method(
'getCurrentScope')
189 ->willReturn($scope);
190 $this->assertEquals($limitNumber, $this->model->getMaxNumberPasswordResetRequests());
200 $this->scopeConfigMock->expects($this->once())
204 . \
Magento\Security\Model\Config::XML_PATH_MIN_TIME_BETWEEN_PASSWORD_RESET_REQUESTS
206 ->willReturn($limitTime);
207 $this->scopeMock->expects($this->once())
208 ->method(
'getCurrentScope')
209 ->willReturn($scope);
210 $this->assertEquals($limitTime * 60, $this->model->getMinTimeBetweenPasswordResetRequests());
dataProviderResetMethodValues()
testGetCustomerServiceEmail()
testGetLimitationTimePeriod()
dataProviderNumberValueWithScope()
testGetAdminSessionLifetime()
testGetMinTimeBetweenPasswordResetRequests($limitTime, $scope)
testGetMaxNumberPasswordResetRequests($limitNumber, $scope)
testGetPasswordResetProtectionType($resetMethod, $scope)
testIsAdminAccountSharingIsEnabled($isShared)