You are here

public function TelephoneFieldTest::testTelephoneFormatter in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/telephone/tests/src/Functional/TelephoneFieldTest.php \Drupal\Tests\telephone\Functional\TelephoneFieldTest::testTelephoneFormatter()
  2. 10 core/modules/telephone/tests/src/Functional/TelephoneFieldTest.php \Drupal\Tests\telephone\Functional\TelephoneFieldTest::testTelephoneFormatter()

Test the telephone formatter.

@covers \Drupal\telephone\Plugin\Field\FieldFormatter\TelephoneLinkFormatter::viewElements

@dataProvider providerPhoneNumbers

File

core/modules/telephone/tests/src/Functional/TelephoneFieldTest.php, line 102

Class

TelephoneFieldTest
Tests the creation of telephone fields.

Namespace

Drupal\Tests\telephone\Functional

Code

public function testTelephoneFormatter($input, $expected) {

  // Test basic entry of telephone field.
  $edit = [
    'title[0][value]' => $this
      ->randomMachineName(),
    'field_telephone[0][value]' => $input,
  ];
  $this
    ->drupalPostForm('node/add/article', $edit, t('Save'));
  $this
    ->assertRaw('<a href="tel:' . $expected . '">');
}