public function SmsSendToPhoneBrowserTest::setUp in SMS Framework 8
Same name and namespace in other branches
- 2.x modules/sms_sendtophone/tests/src/Functional/SmsSendToPhoneBrowserTest.php \Drupal\Tests\sms_sendtophone\Functional\SmsSendToPhoneBrowserTest::setUp()
- 2.1.x modules/sms_sendtophone/tests/src/Functional/SmsSendToPhoneBrowserTest.php \Drupal\Tests\sms_sendtophone\Functional\SmsSendToPhoneBrowserTest::setUp()
Overrides SmsFrameworkBrowserTestBase::setUp
File
- modules/
sms_sendtophone/ tests/ src/ Functional/ SmsSendToPhoneBrowserTest.php, line 49
Class
- SmsSendToPhoneBrowserTest
- Integration tests for the SMS SendToPhone Module.
Namespace
Drupal\Tests\sms_sendtophone\FunctionalCode
public function setUp() {
parent::setUp();
// Create Basic page and Article node types.
if ($this->profile != 'standard') {
$this
->drupalCreateContentType([
'type' => 'page',
'name' => 'Basic page',
'display_submitted' => FALSE,
]);
$this
->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
]);
}
$this->gateway = $this
->createMemoryGateway([
'skip_queue' => TRUE,
]);
$this
->setFallbackGateway($this->gateway);
$this->phoneField = FieldStorageConfig::create([
'entity_type' => 'user',
'field_name' => Unicode::strtolower($this
->randomMachineName()),
'type' => 'telephone',
]);
$this->phoneField
->save();
FieldConfig::create([
'entity_type' => 'user',
'bundle' => 'user',
'field_name' => $this->phoneField
->getName(),
])
->save();
$this->phoneNumberSettings = PhoneNumberSettings::create();
$this->phoneNumberSettings
->setPhoneNumberEntityTypeId('user')
->setPhoneNumberBundle('user')
->setFieldName('phone_number', $this->phoneField
->getName())
->setVerificationMessage($this
->randomString())
->save();
}