/**
  * Apply config filters
  *
  * @param RequestCollection $passwordResetRequestEventCollection
  * @param int $securityEventType
  * @param string $accountReference
  * @param int $longIp
  * @return RequestCollection
  */
 protected function applyFiltersByConfig(RequestCollection $passwordResetRequestEventCollection, $securityEventType, $accountReference, $longIp)
 {
     $limitMethod = $this->securityConfig->getLimitPasswordResetRequestsMethod($this->getScopeByEventType($securityEventType));
     switch ($limitMethod) {
         case ResetMethod::OPTION_BY_EMAIL:
             $passwordResetRequestEventCollection->filterByAccountReference($accountReference);
             break;
         case ResetMethod::OPTION_BY_IP:
             $passwordResetRequestEventCollection->filterByIp($longIp);
             break;
         case ResetMethod::OPTION_BY_IP_AND_EMAIL:
             $passwordResetRequestEventCollection->filterByIpOrAccountReference($longIp, $accountReference);
             break;
     }
     return $passwordResetRequestEventCollection;
 }
 /**
  * @return void
  */
 public function testFilterByIp()
 {
     $ip = 12345;
     $this->collectionMock->expects($this->once())->method('addFieldToFilter')->with('ip', $ip)->willReturnSelf();
     $this->assertEquals($this->collectionMock, $this->collectionMock->filterByIp($ip));
 }
 /**
  * filterByIp() test
  *
  * @magentoDataFixture Magento/Security/_files/password_reset_request_events.php
  */
 public function testFilterByIp()
 {
     $this->collectionModel->filterByIp('3232249856')->load();
     $this->assertEquals(1, $this->collectionModel->getSize());
 }