You are here

protected function SmsBlastBrowserTest::setUp in SMS Framework 8

Same name and namespace in other branches
  1. 2.x modules/sms_blast/tests/src/Functional/SmsBlastBrowserTest.php \Drupal\Tests\sms_blast\Functional\SmsBlastBrowserTest::setUp()
  2. 2.1.x modules/sms_blast/tests/src/Functional/SmsBlastBrowserTest.php \Drupal\Tests\sms_blast\Functional\SmsBlastBrowserTest::setUp()

Overrides SmsFrameworkBrowserTestBase::setUp

File

modules/sms_blast/tests/src/Functional/SmsBlastBrowserTest.php, line 33

Class

SmsBlastBrowserTest
Integration tests for the sms_blast module.

Namespace

Drupal\Tests\sms_blast\Functional

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'Send SMS Blast',
  ]));
  $this->gateway = $this
    ->createMemoryGateway([
    'skip_queue' => TRUE,
  ]);
  $this
    ->setFallbackGateway($this->gateway);
  $phone_field = FieldStorageConfig::create([
    'entity_type' => 'user',
    'field_name' => Unicode::strtolower($this
      ->randomMachineName()),
    'type' => 'telephone',
  ]);
  $phone_field
    ->save();
  FieldConfig::create([
    'entity_type' => 'user',
    'bundle' => 'user',
    'field_name' => $phone_field
      ->getName(),
  ])
    ->save();
  $this->phoneNumberSettings = PhoneNumberSettings::create();
  $this->phoneNumberSettings
    ->setPhoneNumberEntityTypeId('user')
    ->setPhoneNumberBundle('user')
    ->setFieldName('phone_number', $phone_field
    ->getName())
    ->setVerificationMessage($this
    ->randomString())
    ->save();
}