objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); } /** * @magentoDataFixture Magento/Captcha/_files/failed_logins_frontend.php */ public function testSuccesfulLoginRemovesFailedAttempts() { $customerEmail = 'mageuser@dummy.com'; $customerFactory = $this->objectManager->get(CustomerFactory::class); $captchaLogFactory = $this->objectManager->get(LogFactory::class); $eventManager = $this->objectManager->get(ManagerInterface::class); /** @var Customer $customer */ $customer = $customerFactory->create(); $customer->setEmail($customerEmail); $eventManager->dispatch( 'customer_customer_authenticated', ['model' => $customer, 'password' => 'some_password'] ); /** * @var CaptchaLog $captchaLog */ $captchaLog = $captchaLogFactory->create(); self::assertEquals(0, $captchaLog->countAttemptsByUserLogin($customerEmail)); } }