You are here

public function PhoneInternationalFieldTest::testTelephoneFormatter in International Phone 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/PhoneInternationalFieldTest.php \Drupal\Tests\phone_international\Functional\PhoneInternationalFieldTest::testTelephoneFormatter()
  2. 3.x tests/src/Functional/PhoneInternationalFieldTest.php \Drupal\Tests\phone_international\Functional\PhoneInternationalFieldTest::testTelephoneFormatter()

Test the phone_international formatter.

@covers \Drupal\phone_international\Plugin\Field\FieldFormatter\PhoneInternationalDefaultFormatter::viewElements

@dataProvider providerPhoneNumbers

File

tests/src/Functional/PhoneInternationalFieldTest.php, line 57

Class

PhoneInternationalFieldTest
Simple test to ensure that main page loads with module enabled.

Namespace

Drupal\Tests\phone_international\Functional

Code

public function testTelephoneFormatter($input, $expected) {
  $edit = [
    'title[0][value]' => $this
      ->randomMachineName(),
    'field_phone_international[0][value]' => $input,
  ];
  $this
    ->drupalPostForm('node/add/article', $edit, t('Save'));
  $this
    ->assertRaw($expected);
}