You are here

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

Ensure non-global tokens and [user:password] are replaced in reply message.

File

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

Class

SmsFrameworkUserAccountRegistrationServiceTest
Tests account registration.

Namespace

Drupal\Tests\sms_user\Kernel

Code

public function testReplyTokens() {
  $this
    ->config('sms_user.settings')
    ->set('account_registration.incoming_pattern.status', TRUE)
    ->set('account_registration.incoming_pattern.incoming_messages.0', "[username] [password]")
    ->set('account_registration.incoming_pattern.reply.status', TRUE)
    ->set('account_registration.incoming_pattern.reply.message', 'Username is [user:account-name] Password is [user:password]')
    ->save();
  $username = $this
    ->randomMachineName();
  $password = $this
    ->randomMachineName();
  $incoming_message = $username . ' ' . $password;
  $this
    ->sendIncomingMessage('+123123123', $incoming_message);
  $reply_message = 'Username is ' . $username . ' Password is ' . $password;
  $this
    ->assertTrue($this
    ->inTestMessages($this->gateway, $reply_message));
}