TelephoneFieldRdfaTest.php in Zircon Profile 8
File
core/modules/rdf/src/Tests/Field/TelephoneFieldRdfaTest.php
View source
<?php
namespace Drupal\rdf\Tests\Field;
class TelephoneFieldRdfaTest extends FieldRdfaTestBase {
protected $testValue;
protected $fieldType = 'telephone';
public static $modules = array(
'telephone',
'text',
);
protected function setUp() {
parent::setUp();
$this
->createTestField();
$mapping = rdf_get_mapping('entity_test', 'entity_test');
$mapping
->setFieldMapping($this->fieldName, array(
'properties' => array(
'schema:telephone',
),
))
->save();
$this->testValue = '555-555-5555';
$this->entity = entity_create('entity_test', array());
$this->entity->{$this->fieldName}->value = $this->testValue;
}
public function testAllFormatters() {
$this
->assertFormatterRdfa(array(
'type' => 'string',
), 'http://schema.org/telephone', array(
'value' => $this->testValue,
));
$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',
);
$this
->assertFormatterRdfa($formatter, 'http://schema.org/telephone', $expected_rdf_value);
}
}