You are here

public function SmsFrameworkUserSettingsTest::testAccountRegistrationValidationEmptyReplies in SMS Framework 2.1.x

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

Test account registrations validation failures on empty replies.

File

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

Class

SmsFrameworkUserSettingsTest
Tests SMS User settings user interface.

Namespace

Drupal\Tests\sms_user\Functional

Code

public function testAccountRegistrationValidationEmptyReplies() {
  $this
    ->createPhoneNumberSettings('user', 'user');
  $edit = [
    'account_registration[behaviour]' => 'all',
    'account_registration[all_options][reply_status]' => TRUE,
    'account_registration[all_options][reply][message]' => '',
  ];
  $this
    ->drupalPostForm(Url::fromRoute('sms_user.options'), $edit, 'Save configuration');
  $this
    ->assertRaw('Reply message must have a value if reply is enabled.', 'Validation failed for message on all unrecognised numbers when reply status is enabled.');
  $edit = [
    'account_registration[behaviour]' => 'incoming_pattern',
    'account_registration[incoming_pattern_options][reply_status]' => TRUE,
    'account_registration[incoming_pattern_options][reply][message_success]' => '',
  ];
  $this
    ->drupalPostForm(Url::fromRoute('sms_user.options'), $edit, 'Save configuration');
  $this
    ->assertRaw('Reply message must have a value if reply is enabled.', 'Validation failed for message_success on incoming_pattern when reply status is enabled.');
  $edit = [
    'account_registration[behaviour]' => 'incoming_pattern',
    'account_registration[incoming_pattern_options][reply_status]' => TRUE,
    'account_registration[incoming_pattern_options][reply][message_failure]' => '',
  ];
  $this
    ->drupalPostForm(Url::fromRoute('sms_user.options'), $edit, 'Save configuration');
  $this
    ->assertRaw('Reply message must have a value if reply is enabled.', 'Validation failed for message_failure on incoming_pattern when reply status is enabled.');
}