You are here

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

Test if a user is created despite no email address.

File

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

Class

SmsFrameworkUserAccountRegistrationServiceTest
Tests account registration.

Namespace

Drupal\Tests\sms_user\Kernel

Code

public function testIncomingPatternNoEmail() {
  $this
    ->config('sms_user.settings')
    ->set('account_registration.incoming_pattern.status', 1)
    ->set('account_registration.incoming_pattern.incoming_messages.0', "[username] [password]")
    ->save();
  $this
    ->assertEquals(0, $this
    ->countUsers());
  $username = $this
    ->randomMachineName();
  $message = "{$username} " . $this
    ->randomMachineName();
  $this
    ->sendIncomingMessage('+123123123', $message);
  $this
    ->assertEquals($username, $this
    ->getLastUser()
    ->getAccountName());
  $this
    ->assertTrue(empty($this
    ->getLastUser()
    ->getEmail()));
}