You are here

public function SmsFrameworkUserAccountRegistrationServiceTest::testUniqueUsername in SMS Framework 8

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

Test unique username.

@covers ::generateUniqueUsername

File

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

Class

SmsFrameworkUserAccountRegistrationServiceTest
Tests account registration.

Namespace

Drupal\Tests\sms_user\Kernel

Code

public function testUniqueUsername() {
  $this
    ->config('sms_user.settings')
    ->set('account_registration.unrecognized_sender.status', 1)
    ->save();
  $this
    ->sendIncomingMessage('+123123123', $this
    ->randomString());
  $user1 = $this
    ->getLastUser();
  $this
    ->sendIncomingMessage('+456456456', $this
    ->randomString());
  $user2 = $this
    ->getLastUser();
  $this
    ->assertNotEquals($user1
    ->getAccountName(), $user2
    ->getAccountName());
}