You are here

public function FieldFormatterTest::telephoneDataProvider in Telephone Formatter 8

Different test scenarios for Telephone formatter.

File

tests/src/Functional/FieldFormatterTest.php, line 99

Class

FieldFormatterTest
Tests the creation of telephone fields.

Namespace

Drupal\Tests\telephone_formatter\Functional

Code

public function telephoneDataProvider() {
  return [
    [
      'format' => PhoneNumberFormat::INTERNATIONAL,
      'link' => FALSE,
      'default_country' => NULL,
      'expected' => '98765432',
      'value' => '98765432',
    ],
    [
      'format' => PhoneNumberFormat::INTERNATIONAL,
      'link' => TRUE,
      'default_country' => 'SI',
      'expected' => '<a href="tel:+386-1-425-68-58">+386 1 425 68 58</a>',
      'value' => '014256858',
    ],
    [
      'format' => PhoneNumberFormat::E164,
      'link' => TRUE,
      'default_country' => 'SI',
      'expected' => '<a href="tel:+386-51-333-333">+38651333333</a>',
      'value' => '051333333',
    ],
    [
      'format' => PhoneNumberFormat::NATIONAL,
      'link' => FALSE,
      'default_country' => 'SI',
      'expected' => '(03) 425 68 58',
      'value' => '034256858',
    ],
    [
      'format' => PhoneNumberFormat::RFC3966,
      'link' => FALSE,
      'default_country' => 'SI',
      'expected' => 'tel:+386-70-123-456',
      'value' => '070 123 456',
    ],
  ];
}