public function SmsFrameworkUserAccountRegistrationServiceTest::testIncomingPatternNoPlaceholders in SMS Framework 2.1.x
Same name and namespace in other branches
- 8 modules/sms_user/tests/src/Kernel/SmsFrameworkUserAccountRegistrationServiceTest.php \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserAccountRegistrationServiceTest::testIncomingPatternNoPlaceholders()
- 2.x modules/sms_user/tests/src/Kernel/SmsFrameworkUserAccountRegistrationServiceTest.php \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserAccountRegistrationServiceTest::testIncomingPatternNoPlaceholders()
Test if a user is created despite no placeholders.
File
- modules/
sms_user/ tests/ src/ Kernel/ SmsFrameworkUserAccountRegistrationServiceTest.php, line 330
Class
- SmsFrameworkUserAccountRegistrationServiceTest
- Tests account registration.
Namespace
Drupal\Tests\sms_user\KernelCode
public function testIncomingPatternNoPlaceholders() {
$incoming_message = $this
->randomString();
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', 1)
->set('account_registration.incoming_pattern.incoming_messages.0', $incoming_message)
->set('account_registration.incoming_pattern.reply.status', TRUE)
->set('account_registration.incoming_pattern.reply.message', '[user:account-name] Foo [user:mail]')
->save();
$this
->assertEquals(0, $this
->countUsers());
$this
->sendIncomingMessage('+123123123', $incoming_message);
$this
->assertEquals(1, $this
->countUsers());
// Check reply contains randomly generated username, and empty email token.
$user = $this
->getLastUser();
$reply_message = $user
->getAccountName() . ' Foo ' . $user
->getEmail();
$reply = $this
->getLastTestMessage($this->gateway);
$this
->assertEquals($reply_message, $reply
->getMessage());
}