You are here

public function TelephoneFieldRdfaTest::testAllFormatters in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/rdf/src/Tests/Field/TelephoneFieldRdfaTest.php \Drupal\rdf\Tests\Field\TelephoneFieldRdfaTest::testAllFormatters()

Tests the field formatters.

File

core/modules/rdf/src/Tests/Field/TelephoneFieldRdfaTest.php, line 53
Contains \Drupal\rdf\Tests\Field\TelephoneFieldRdfaTest.

Class

TelephoneFieldRdfaTest
Tests RDFa output by telephone field formatters.

Namespace

Drupal\rdf\Tests\Field

Code

public function testAllFormatters() {

  // Tests the plain formatter.
  $this
    ->assertFormatterRdfa(array(
    'type' => 'string',
  ), 'http://schema.org/telephone', array(
    'value' => $this->testValue,
  ));

  // Tests the telephone link formatter.
  $this
    ->assertFormatterRdfa(array(
    'type' => 'telephone_link',
  ), 'http://schema.org/telephone', array(
    'value' => 'tel:' . $this->testValue,
    'type' => 'uri',
  ));
  $formatter = array(
    'type' => 'telephone_link',
    'settings' => array(
      'title' => 'Contact us',
    ),
  );
  $expected_rdf_value = array(
    'value' => 'tel:' . $this->testValue,
    'type' => 'uri',
  );

  // Tests the telephone link formatter with custom title.
  $this
    ->assertFormatterRdfa($formatter, 'http://schema.org/telephone', $expected_rdf_value);
}