protected function SmsFrameworkVerificationMaintenanceTest::setUp in SMS Framework 8
Same name and namespace in other branches
- 2.x tests/src/Kernel/SmsFrameworkVerificationMaintenanceTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkVerificationMaintenanceTest::setUp()
- 2.1.x tests/src/Kernel/SmsFrameworkVerificationMaintenanceTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkVerificationMaintenanceTest::setUp()
Overrides SmsFrameworkKernelBase::setUp
File
- tests/src/ Kernel/ SmsFrameworkVerificationMaintenanceTest.php, line 44 
Class
- SmsFrameworkVerificationMaintenanceTest
- Tests verification maintenance executed during cron.
Namespace
Drupal\Tests\sms\KernelCode
protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('entity_test');
  $this
    ->installEntitySchema('sms_phone_number_verification');
  $this->phoneField = FieldStorageConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => Unicode::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())
    ->setPurgeVerificationPhoneNumber(FALSE)
    ->setVerificationCodeLifetime(3600)
    ->setVerificationMessage($this
    ->randomString())
    ->save();
  $gateway = $this
    ->createMemoryGateway([
    'skip_queue' => TRUE,
  ]);
  $this
    ->setFallbackGateway($gateway);
  $this->testEntity = $this
    ->createEntityWithPhoneNumber($this->phoneNumberSettings, [
    '+123123123',
  ]);
}