You are here

public function SmsFrameworkUserSettingsTest::testFormNoUserPhoneNumberSettings in SMS Framework 8

Same name and namespace in other branches
  1. 2.x modules/sms_user/tests/src/Functional/SmsFrameworkUserSettingsTest.php \Drupal\Tests\sms_user\Functional\SmsFrameworkUserSettingsTest::testFormNoUserPhoneNumberSettings()
  2. 2.1.x modules/sms_user/tests/src/Functional/SmsFrameworkUserSettingsTest.php \Drupal\Tests\sms_user\Functional\SmsFrameworkUserSettingsTest::testFormNoUserPhoneNumberSettings()

Test form state when no phone number settings exist for user entity type.

Tests notice is displayed and some form elements are disabled.

File

modules/sms_user/tests/src/Functional/SmsFrameworkUserSettingsTest.php, line 276

Class

SmsFrameworkUserSettingsTest
Tests SMS User settings user interface.

Namespace

Drupal\Tests\sms_user\Functional

Code

public function testFormNoUserPhoneNumberSettings() {
  $this
    ->drupalGet(Url::fromRoute('sms_user.options'));
  $this
    ->assertRaw('There are no phone number settings configured for the user entity type. Some features cannot operate without these settings. <a href="' . Url::fromRoute('entity.phone_number_settings.add')
    ->toString() . '">Add phone number settings</a>.', 'Warning message displayed for no phone number settings.');
  $input = $this
    ->xpath('//input[@name="account_registration[behaviour]" and @disabled="disabled" and @value="all"]');
  $this
    ->assertTrue(count($input) === 1, "The 'All unrecognised phone numbers' radio is disabled.");
  $input = $this
    ->xpath('//input[@name="account_registration[behaviour]" and @disabled="disabled" and @value="incoming_pattern"]');
  $this
    ->assertTrue(count($input) === 1, "The 'incoming_pattern' radio is disabled.");
}