You are here

public function SmsFrameworkUserAccountRegistrationServiceTest::testIncomingPatternMultiplePlaceholderFailure in SMS Framework 2.x

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

Test if a duplicated placeholder is not confirmed.

File

modules/sms_user/tests/src/Kernel/SmsFrameworkUserAccountRegistrationServiceTest.php, line 292

Class

SmsFrameworkUserAccountRegistrationServiceTest
Tests account registration.

Namespace

Drupal\Tests\sms_user\Kernel

Code

public function testIncomingPatternMultiplePlaceholderFailure() {
  $this
    ->config('sms_user.settings')
    ->set('account_registration.incoming_pattern.status', 1)
    ->set('account_registration.incoming_pattern.reply.status', 1)
    ->set('account_registration.incoming_pattern.incoming_messages.0', "[password] [username] [password]")
    ->save();
  $username = $this
    ->randomMachineName();
  $password = $this
    ->randomMachineName();
  $password2 = $this
    ->randomMachineName();
  $message = "{$password} {$username} {$password2}";
  $this
    ->sendIncomingMessage('+123123123', $message);
  $this
    ->assertFalse(user_load_by_name($username) instanceof UserInterface, 'User was not created');
}