protected function SmsFrameworkPhoneNumberVerificationTest::setUp in SMS Framework 2.1.x
Same name and namespace in other branches
- 8 tests/src/Kernel/SmsFrameworkPhoneNumberVerificationTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkPhoneNumberVerificationTest::setUp()
- 2.x tests/src/Kernel/SmsFrameworkPhoneNumberVerificationTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkPhoneNumberVerificationTest::setUp()
Overrides SmsFrameworkKernelBase::setUp
File
- tests/
src/ Kernel/ SmsFrameworkPhoneNumberVerificationTest.php, line 69
Class
- SmsFrameworkPhoneNumberVerificationTest
- Tests Phone Number Provider.
Namespace
Drupal\Tests\sms\KernelCode
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('entity_test');
$this
->installEntitySchema('sms_phone_number_verification');
$this->gateway = $this
->createMemoryGateway([
'skip_queue' => TRUE,
]);
$this
->setFallbackGateway($this->gateway);
$this->phoneNumberVerificationProvider = $this->container
->get('sms.phone_number.verification');
$this->phoneField = FieldStorageConfig::create([
'entity_type' => 'entity_test',
'field_name' => mb_strtolower($this
->randomMachineName()),
'type' => 'telephone',
]);
$this->phoneField
->save();
FieldConfig::create([
'entity_type' => 'entity_test',
'bundle' => 'entity_test',
'field_name' => $this->phoneField
->getName(),
])
->save();
$this->phoneNumberSettings = PhoneNumberSettings::create();
$this->phoneNumberSettings
->setPhoneNumberEntityTypeId('entity_test')
->setPhoneNumberBundle('entity_test')
->setFieldName('phone_number', $this->phoneField
->getName())
->setVerificationMessage($this
->randomString())
->save();
}