You are here

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

Ensure no activation email sent.

File

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

Class

SmsFrameworkUserAccountRegistrationServiceTest
Tests account registration.

Namespace

Drupal\Tests\sms_user\Kernel

Code

public function testIncomingPatternNoActivateEmail() {
  $this
    ->config('sms_user.settings')
    ->set('account_registration.incoming_pattern.status', TRUE)
    ->set('account_registration.incoming_pattern.incoming_messages.0', "E [email] P [password]")
    ->set('account_registration.incoming_pattern.send_activation_email', TRUE)
    ->save();
  $this
    ->config('user.mail')
    ->set('register_no_approval_required.subject', $this
    ->randomMachineName())
    ->set('register_no_approval_required.body', $this
    ->randomMachineName())
    ->save();
  $email = 'email@domain.tld';
  $password = $this
    ->randomMachineName();
  $this
    ->sendIncomingMessage('+123123123', 'E ' . $email . ' P ' . $password);
  $emails = $this
    ->getMails();
  $this
    ->assertEquals(0, count($emails), 'Zero emails sent because incoming message contained password.');
}