objectManager = Bootstrap::getObjectManager(); $this->accountManagement = $this->objectManager->get(AccountManagementInterface::class); $this->customerRegistry = $this->objectManager->get(CustomerRegistry::class); } /** * @magentoDataFixture Magento/Customer/_files/locked_customer.php * * @return void */ public function testAuthenticateByLockedCustomer(): void { $this->expectExceptionObject(new UserLockedException(__('The account is locked.'))); $this->accountManagement->authenticate('customer@example.com', 'password'); } /** * @magentoAppArea frontend * @magentoDataFixture Magento/Customer/_files/expired_lock_for_customer.php * * @return void */ public function testAuthenticateByCustomerExpiredLock(): void { $email = 'customer@example.com'; $customer = $this->accountManagement->authenticate($email, 'password'); $customerSecure = $this->customerRegistry->retrieveSecureData($customer->getId()); $this->assertEquals(0, $customerSecure->getFailuresNum()); $this->assertNull($customerSecure->getFirstFailure()); $this->assertNull($customerSecure->getLockExpires()); } }