You are here

public function SmsFrameworkUserAccountRegistrationServiceTest::testUnrecognisedCreateUserPhoneNumberRecognised 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::testUnrecognisedCreateUserPhoneNumberRecognised()
  2. 2.1.x modules/sms_user/tests/src/Kernel/SmsFrameworkUserAccountRegistrationServiceTest.php \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserAccountRegistrationServiceTest::testUnrecognisedCreateUserPhoneNumberRecognised()

Test a user is not created if the sender phone number is already used.

File

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

Class

SmsFrameworkUserAccountRegistrationServiceTest
Tests account registration.

Namespace

Drupal\Tests\sms_user\Kernel

Code

public function testUnrecognisedCreateUserPhoneNumberRecognised() {
  $this
    ->config('sms_user.settings')
    ->set('account_registration.unrecognized_sender.status', 1)
    ->set('account_registration.unrecognized_sender.reply.status', 1)
    ->save();
  $sender_number = '+123123123';
  $this
    ->createEntityWithPhoneNumber($this->phoneNumberSettings, [
    $sender_number,
  ]);
  $this
    ->resetTestMessages();
  $this
    ->assertEquals(1, $this
    ->countUsers());
  $this
    ->sendIncomingMessage($sender_number, $this
    ->randomString());
  $this
    ->assertEquals(1, $this
    ->countUsers());
  $this
    ->assertEquals(0, count($this
    ->getTestMessages($this->gateway)));
}