EmailFieldRdfaTest.php in Drupal 8
File
core/modules/rdf/tests/src/Kernel/Field/EmailFieldRdfaTest.php
View source
<?php
namespace Drupal\Tests\rdf\Kernel\Field;
use Drupal\entity_test\Entity\EntityTest;
class EmailFieldRdfaTest extends FieldRdfaTestBase {
protected $fieldType = 'email';
public static $modules = [
'text',
];
protected function setUp() {
parent::setUp();
$this
->createTestField();
$mapping = rdf_get_mapping('entity_test', 'entity_test');
$mapping
->setFieldMapping($this->fieldName, [
'properties' => [
'schema:email',
],
])
->save();
$this->testValue = 'test@example.com';
$this->entity = EntityTest::create([]);
$this->entity->{$this->fieldName}->value = $this->testValue;
}
public function testAllFormatters() {
$this
->assertFormatterRdfa([
'type' => 'string',
], 'http://schema.org/email', [
'value' => $this->testValue,
]);
$this
->assertFormatterRdfa([
'type' => 'email_mailto',
], 'http://schema.org/email', [
'value' => $this->testValue,
]);
}
}