You are here

public function SmsFrameworkPhoneNumberVerifyForm::testVerifyFormAccess in SMS Framework 2.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/SmsFrameworkPhoneNumberVerifyForm.php \Drupal\Tests\sms\Functional\SmsFrameworkPhoneNumberVerifyForm::testVerifyFormAccess()
  2. 2.1.x tests/src/Functional/SmsFrameworkPhoneNumberVerifyForm.php \Drupal\Tests\sms\Functional\SmsFrameworkPhoneNumberVerifyForm::testVerifyFormAccess()

Test phone number verification form.

File

tests/src/Functional/SmsFrameworkPhoneNumberVerifyForm.php, line 24

Class

SmsFrameworkPhoneNumberVerifyForm
Tests phone numbers verification code form.

Namespace

Drupal\Tests\sms\Functional

Code

public function testVerifyFormAccess() {

  // Anonymous.
  $this
    ->drupalGet(Url::fromRoute('sms.phone.verify'));
  $this
    ->assertResponse(403);

  // User with permission.
  $account = $this
    ->drupalCreateUser([
    'sms verify phone number',
  ]);
  $this
    ->drupalLogin($account);
  $this
    ->drupalGet(Url::fromRoute('sms.phone.verify'));
  $this
    ->assertResponse(200);
  $this
    ->assertText(t('Verify a phone number'));
  $this
    ->assertText(t('Enter the code you received from a SMS message.'));
}