You are here

public function SmsFrameworkPhoneNumberProviderTest::testGetPhoneNumbersNoVerification in SMS Framework 8

Same name and namespace in other branches
  1. 2.x tests/src/Kernel/SmsFrameworkPhoneNumberProviderTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkPhoneNumberProviderTest::testGetPhoneNumbersNoVerification()
  2. 2.1.x tests/src/Kernel/SmsFrameworkPhoneNumberProviderTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkPhoneNumberProviderTest::testGetPhoneNumbersNoVerification()

Tests getting a phone number, where no verification exists.

Normally a phone number verification is maintained as field values change, via updatePhoneVerificationByEntity. However field values may exist before a phone number settings map exist, or values may be entered in manually, such as with migrate with hooks turned off.

@covers ::getPhoneNumbers

File

tests/src/Kernel/SmsFrameworkPhoneNumberProviderTest.php, line 168

Class

SmsFrameworkPhoneNumberProviderTest
Tests Phone Number Provider.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testGetPhoneNumbersNoVerification() {
  $phoneNumberSettings = $this->phoneNumberSettings;
  $this->phoneNumberSettings
    ->delete();

  // Explicitly don't use createEntityWithPhoneNumber because we dont have
  // phone number settings yet.
  $entity = EntityTest::create([
    $this->phoneField
      ->getName() => '+123123123',
  ]);
  $entity
    ->save();

  // Recreate settings.
  $phoneNumberSettings
    ->save();

  // Must check for verified:
  $this
    ->assertEquals([], $this->phoneNumberProvider
    ->getPhoneNumbers($entity, TRUE));
}