You are here

public function SmsFrameworkPhoneNumberProviderTest::testGetPhoneNumbersUnverified in SMS Framework 8

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

Tests phone numbers.

@covers ::getPhoneNumbers

File

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

Class

SmsFrameworkPhoneNumberProviderTest
Tests Phone Number Provider.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testGetPhoneNumbersUnverified() {
  $phone_numbers_all = [
    '+123123123',
    '+456456456',
  ];

  // Test zero, one, multiple phone numbers.
  for ($i = 0; $i < 3; $i++) {
    $phone_numbers = array_slice($phone_numbers_all, 0, $i);
    $entity = $this
      ->createEntityWithPhoneNumber($this->phoneNumberSettings, $phone_numbers);
    $return = $this->phoneNumberProvider
      ->getPhoneNumbers($entity, NULL);
    $this
      ->assertEquals($phone_numbers, $return);
    $return = $this->phoneNumberProvider
      ->getPhoneNumbers($entity, FALSE);
    $this
      ->assertEquals($phone_numbers, $return);
    $return = $this->phoneNumberProvider
      ->getPhoneNumbers($entity, TRUE);
    $this
      ->assertEquals([], $return);
  }
}