public function SmsFrameworkUserTest::testAccountRegistrationNoPhoneSettings in SMS Framework 8
Same name and namespace in other branches
- 2.x modules/sms_user/tests/src/Kernel/SmsFrameworkUserTest.php \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserTest::testAccountRegistrationNoPhoneSettings()
- 2.1.x modules/sms_user/tests/src/Kernel/SmsFrameworkUserTest.php \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserTest::testAccountRegistrationNoPhoneSettings()
Ensure account registration service does not crash if missing user config.
Ensure sms_user.account_registration service does not crash and burn if there are no phone number settings for user.user.
File
- modules/
sms_user/ tests/ src/ Kernel/ SmsFrameworkUserTest.php, line 66
Class
- SmsFrameworkUserTest
- General tests for SMS User.
Namespace
Drupal\Tests\sms_user\KernelCode
public function testAccountRegistrationNoPhoneSettings() {
$this
->config('sms_user.settings')
->set('account_registration.unrecognized_sender.status', 1)
->set('account_registration.unrecognized_sender.reply.status', 1)
->save();
$message = $this
->randomString();
$incoming = SmsMessage::create()
->setSenderNumber('+123')
->setDirection(Direction::INCOMING)
->setMessage($message)
->addRecipients($this
->randomPhoneNumbers(1))
->setGateway($this->gateway);
$incoming
->setResult($this
->createMessageResult($incoming));
$this->smsProvider
->queue($incoming);
$this
->assertEquals($message, sms_test_gateway_get_incoming()['message']);
// Make sure the phone number settings does not exist, in case it makes its
// way into this test in the future.
$this
->assertNull(PhoneNumberSettings::load('user.user'), 'No phone numbser settings for user.user.');
}