public function SmsFrameworkUserSettingsTest::testAccountRegistrationIncomingPattern in SMS Framework 8
Same name and namespace in other branches
- 2.x modules/sms_user/tests/src/Functional/SmsFrameworkUserSettingsTest.php \Drupal\Tests\sms_user\Functional\SmsFrameworkUserSettingsTest::testAccountRegistrationIncomingPattern()
- 2.1.x modules/sms_user/tests/src/Functional/SmsFrameworkUserSettingsTest.php \Drupal\Tests\sms_user\Functional\SmsFrameworkUserSettingsTest::testAccountRegistrationIncomingPattern()
Test account registrations for incoming pattern saves to config.
File
- modules/
sms_user/ tests/ src/ Functional/ SmsFrameworkUserSettingsTest.php, line 170
Class
- SmsFrameworkUserSettingsTest
- Tests SMS User settings user interface.
Namespace
Drupal\Tests\sms_user\FunctionalCode
public function testAccountRegistrationIncomingPattern() {
$this
->createPhoneNumberSettings('user', 'user');
$incoming_message = '[email] ' . $this
->randomString();
$reply_message_success = $this
->randomString();
$reply_message_failure = $this
->randomString();
$edit = [
'account_registration[behaviour]' => 'incoming_pattern',
'account_registration[incoming_pattern_options][incoming_message]' => $incoming_message,
'account_registration[incoming_pattern_options][send_activation_email]' => TRUE,
'account_registration[incoming_pattern_options][reply_status]' => TRUE,
'account_registration[incoming_pattern_options][reply][message_success]' => $reply_message_success,
'account_registration[incoming_pattern_options][reply][message_failure]' => $reply_message_failure,
];
$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
->assertFalse($settings['unrecognized_sender']['status']);
$this
->assertTrue($settings['incoming_pattern']['status']);
// Settings.
$this
->assertEquals($incoming_message, $settings['incoming_pattern']['incoming_messages'][0]);
$this
->assertTrue($settings['incoming_pattern']['send_activation_email']);
$this
->assertTrue($settings['incoming_pattern']['reply']['status']);
$this
->assertEquals($reply_message_success, $settings['incoming_pattern']['reply']['message']);
$this
->assertEquals($reply_message_failure, $settings['incoming_pattern']['reply']['message_failure']);
}