class EmailFieldRdfaTest
Same name and namespace in other branches
- 8.9.x core/modules/rdf/tests/src/Kernel/Field/EmailFieldRdfaTest.php \Drupal\Tests\rdf\Kernel\Field\EmailFieldRdfaTest
Tests RDFa output by email field formatters.
@group rdf @group legacy
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\field\Kernel\FieldKernelTestBase implements \Drupal\KernelTests\KernelTestBase
- class \Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase uses \Drupal\Tests\rdf\Traits\RdfParsingTrait implements \Drupal\Tests\field\Kernel\FieldKernelTestBase
- class \Drupal\Tests\rdf\Kernel\Field\EmailFieldRdfaTest implements \Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase
- class \Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase uses \Drupal\Tests\rdf\Traits\RdfParsingTrait implements \Drupal\Tests\field\Kernel\FieldKernelTestBase
- class \Drupal\Tests\field\Kernel\FieldKernelTestBase implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of EmailFieldRdfaTest
File
-
core/
modules/ rdf/ tests/ src/ Kernel/ Field/ EmailFieldRdfaTest.php, line 13
Namespace
Drupal\Tests\rdf\Kernel\FieldView source
class EmailFieldRdfaTest extends FieldRdfaTestBase {
/**
* {@inheritdoc}
*/
protected $fieldType = 'email';
/**
* {@inheritdoc}
*/
protected static $modules = [
'text',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->createTestField();
// Add the mapping.
$mapping = rdf_get_mapping('entity_test', 'entity_test');
$mapping->setFieldMapping($this->fieldName, [
'properties' => [
'schema:email',
],
])
->save();
// Set up test values.
$this->testValue = 'test@example.com';
$this->entity = EntityTest::create([]);
$this->entity->{$this->fieldName}->value = $this->testValue;
}
/**
* Tests all email formatters.
*/
public function testAllFormatters() {
// Test the plain formatter.
$this->assertFormatterRdfa([
'type' => 'string',
], 'http://schema.org/email', [
'value' => $this->testValue,
]);
// Test the mailto formatter.
$this->assertFormatterRdfa([
'type' => 'email_mailto',
], 'http://schema.org/email', [
'value' => $this->testValue,
]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.