public function SmsFrameworkUserSettingsTest::testAccountRegistrationValidationIncomingPattern in SMS Framework 2.x
Same name and namespace in other branches
- 8 modules/sms_user/tests/src/Functional/SmsFrameworkUserSettingsTest.php \Drupal\Tests\sms_user\Functional\SmsFrameworkUserSettingsTest::testAccountRegistrationValidationIncomingPattern()
- 2.1.x modules/sms_user/tests/src/Functional/SmsFrameworkUserSettingsTest.php \Drupal\Tests\sms_user\Functional\SmsFrameworkUserSettingsTest::testAccountRegistrationValidationIncomingPattern()
Test account registrations validation failures on empty replies.
File
- modules/
sms_user/ tests/ src/ Functional/ SmsFrameworkUserSettingsTest.php, line 242
Class
- SmsFrameworkUserSettingsTest
- Tests SMS User settings user interface.
Namespace
Drupal\Tests\sms_user\FunctionalCode
public function testAccountRegistrationValidationIncomingPattern() {
$this
->createPhoneNumberSettings('user', 'user');
$edit = [
'account_registration[behaviour]' => 'incoming_pattern',
'account_registration[incoming_pattern_options][incoming_message]' => '',
];
$this
->drupalPostForm(Url::fromRoute('sms_user.options'), $edit, 'Save configuration');
$this
->assertRaw('Incoming message must be filled if using pre-incoming_pattern option');
$edit = [
'account_registration[behaviour]' => 'incoming_pattern',
'account_registration[incoming_pattern_options][send_activation_email]' => TRUE,
'account_registration[incoming_pattern_options][incoming_message]' => $this
->randomString(),
];
$this
->drupalPostForm(Url::fromRoute('sms_user.options'), $edit, 'Save configuration');
$this
->assertRaw('Activation email cannot be sent if [email] placeholder is missing.');
$edit = [
'account_registration[behaviour]' => 'incoming_pattern',
'account_registration[incoming_pattern_options][send_activation_email]' => TRUE,
'account_registration[incoming_pattern_options][incoming_message]' => 'E [email] P [password]',
];
$this
->drupalPostForm(Url::fromRoute('sms_user.options'), $edit, 'Save configuration');
$this
->assertRaw('Activation email cannot be sent if [password] placeholder is present.');
// Placeholder seperation.
// Tests separator so regex doesn't have problems.
$edit = [
'account_registration[behaviour]' => 'incoming_pattern',
'account_registration[incoming_pattern_options][incoming_message]' => 'Email [email][password]',
];
$this
->drupalPostForm(Url::fromRoute('sms_user.options'), $edit, 'Save configuration');
$this
->assertRaw('There must be a separator between placeholders.');
}