class DateTimeFieldRdfaTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/rdf/tests/src/Kernel/Field/DateTimeFieldRdfaTest.php \Drupal\Tests\rdf\Kernel\Field\DateTimeFieldRdfaTest
- 9 core/modules/rdf/tests/src/Kernel/Field/DateTimeFieldRdfaTest.php \Drupal\Tests\rdf\Kernel\Field\DateTimeFieldRdfaTest
Tests RDFa output by datetime field formatters.
@group rdf
Hierarchy
- class \Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase extends \Drupal\Tests\field\Kernel\FieldKernelTestBase uses RdfParsingTrait
- class \Drupal\Tests\rdf\Kernel\Field\DateTimeFieldRdfaTest
Expanded class hierarchy of DateTimeFieldRdfaTest
File
- core/
modules/ rdf/ tests/ src/ Kernel/ Field/ DateTimeFieldRdfaTest.php, line 12
Namespace
Drupal\Tests\rdf\Kernel\FieldView source
class DateTimeFieldRdfaTest extends FieldRdfaTestBase {
/**
* {@inheritdoc}
*/
protected $fieldType = 'datetime';
/**
* The 'value' property value for testing.
*
* @var string
*/
protected $testValue = '2014-01-28T06:01:01';
/**
* {@inheritdoc}
*/
protected static $modules = [
'datetime',
];
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:dateCreated',
],
])
->save();
// Set up test entity.
$this->entity = EntityTest::create([]);
$this->entity->{$this->fieldName}->value = $this->testValue;
}
/**
* Tests the default formatter.
*/
public function testDefaultFormatter() {
$this
->assertFormatterRdfa([
'type' => 'datetime_default',
], 'http://schema.org/dateCreated', [
'value' => $this->testValue . 'Z',
'type' => 'literal',
'datatype' => 'http://www.w3.org/2001/XMLSchema#dateTime',
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DateTimeFieldRdfaTest:: |
protected | property |
The machine name of the field type to test. Overrides FieldRdfaTestBase:: |
|
DateTimeFieldRdfaTest:: |
protected static | property |
Modules to enable. Overrides FieldRdfaTestBase:: |
|
DateTimeFieldRdfaTest:: |
protected | property |
The 'value' property value for testing. Overrides FieldRdfaTestBase:: |
|
DateTimeFieldRdfaTest:: |
protected | function | ||
DateTimeFieldRdfaTest:: |
public | function | Tests the default formatter. | |
FieldRdfaTestBase:: |
protected | property | TRUE if verbose debugging is enabled. | |
FieldRdfaTestBase:: |
protected | property | The entity to render for testing. | |
FieldRdfaTestBase:: |
protected | property | The name of the field to create for testing. | |
FieldRdfaTestBase:: |
protected | property | The URI to identify the entity. | |
FieldRdfaTestBase:: |
protected | function | Helper function to test the formatter's RDFa. | |
FieldRdfaTestBase:: |
protected | function | Creates the field for testing. | |
FieldRdfaTestBase:: |
protected | function | Gets the absolute URI of an entity. | |
FieldRdfaTestBase:: |
protected | function | Parses a content and return the html element. | |
FieldRdfaTestBase:: |
protected | function | Performs an xpath search on a certain content. | |
RdfParsingTrait:: |
protected | function | Counts the number of resources of the provided type. | |
RdfParsingTrait:: |
protected | function | Gets type of RDF Element. | |
RdfParsingTrait:: |
protected | function | Checks if a html document contains a resource with a given property value. | |
RdfParsingTrait:: |
protected | function | Checks if a html document contains a resource with a given property value. | |
RdfParsingTrait:: |
protected | function | Checks if RDF Node property is blank. |