Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ResetAttemptForFrontendAccountEditObserverTest.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
11 use Magento\Captcha\Model\ResourceModel\LogFactory;
14 
20 class ResetAttemptForFrontendAccountEditObserverTest extends \PHPUnit\Framework\TestCase
21 {
25  private $objectManager;
26 
27  public function setUp()
28  {
30  }
31 
35  public function testAccountEditRemovesFailedAttempts()
36  {
38  $captchaLogFactory = $this->objectManager->get(LogFactory::class);
39  $eventManager = $this->objectManager->get(ManagerInterface::class);
40 
41  $eventManager->dispatch(
42  'customer_account_edited',
43  ['email' => $customerEmail]
44  );
45 
49  $captchaLog = $captchaLogFactory->create();
50 
51  self::assertEquals(0, $captchaLog->countAttemptsByUserLogin($customerEmail));
52  }
53 }