public function SmsFrameworkPhoneNumberVerifyForm::testVerifyFormFlood in SMS Framework 8
Same name and namespace in other branches
- 2.x tests/src/Functional/SmsFrameworkPhoneNumberVerifyForm.php \Drupal\Tests\sms\Functional\SmsFrameworkPhoneNumberVerifyForm::testVerifyFormFlood()
 - 2.1.x tests/src/Functional/SmsFrameworkPhoneNumberVerifyForm.php \Drupal\Tests\sms\Functional\SmsFrameworkPhoneNumberVerifyForm::testVerifyFormFlood()
 
Test phone number verification form.
File
- tests/
src/ Functional/ SmsFrameworkPhoneNumberVerifyForm.php, line 77  
Class
- SmsFrameworkPhoneNumberVerifyForm
 - Tests phone numbers verification code form.
 
Namespace
Drupal\Tests\sms\FunctionalCode
public function testVerifyFormFlood() {
  // Reduce number of POST requests. Number isn't important.
  \Drupal::configFactory()
    ->getEditable('sms.settings')
    ->set('flood.verify_limit', 1)
    ->save();
  $account = $this
    ->drupalCreateUser([
    'sms verify phone number',
  ]);
  $this
    ->drupalLogin($account);
  $edit['code'] = $this
    ->randomMachineName();
  $this
    ->drupalPostForm(Url::fromRoute('sms.phone.verify'), $edit, t('Verify code'));
  $this
    ->assertNoText(t('There has been too many failed verification attempts. Try again later.'));
  $this
    ->drupalPostForm(Url::fromRoute('sms.phone.verify'), $edit, t('Verify code'));
  $this
    ->assertText(t('There has been too many failed verification attempts. Try again later.'));
}