You are here

public function SmsFrameworkUserSettingsTest::testAccountRegistrationUnrecognised in SMS Framework 2.x

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

Test account registrations for unrecognised numbers saves to config.

File

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

Class

SmsFrameworkUserSettingsTest
Tests SMS User settings user interface.

Namespace

Drupal\Tests\sms_user\Functional

Code

public function testAccountRegistrationUnrecognised() {
  $this
    ->createPhoneNumberSettings('user', 'user');
  $reply_message = $this
    ->randomString();
  $edit = [
    'account_registration[behaviour]' => 'all',
    'account_registration[all_options][reply_status]' => TRUE,
    'account_registration[all_options][reply][message]' => $reply_message,
  ];
  $this
    ->drupalPostForm(Url::fromRoute('sms_user.options'), $edit, 'Save configuration');
  $this
    ->assertRaw('The configuration options have been saved.');
  $settings = $this
    ->config('sms_user.settings')
    ->get('account_registration');

  // Status.
  $this
    ->assertTrue($settings['unrecognized_sender']['status']);
  $this
    ->assertFalse($settings['incoming_pattern']['status']);

  // Settings.
  $this
    ->assertTrue($settings['unrecognized_sender']['reply']['status']);
  $this
    ->assertEquals($reply_message, $settings['unrecognized_sender']['reply']['message']);
}