DateTimeFieldRdfaTest.php in Drupal 10
File
core/modules/rdf/tests/src/Kernel/Field/DateTimeFieldRdfaTest.php
View source
<?php
namespace Drupal\Tests\rdf\Kernel\Field;
use Drupal\entity_test\Entity\EntityTest;
class DateTimeFieldRdfaTest extends FieldRdfaTestBase {
protected $fieldType = 'datetime';
protected $testValue = '2014-01-28T06:01:01';
protected static $modules = [
'datetime',
];
protected function setUp() : void {
parent::setUp();
$this
->createTestField();
$mapping = rdf_get_mapping('entity_test', 'entity_test');
$mapping
->setFieldMapping($this->fieldName, [
'properties' => [
'schema:dateCreated',
],
])
->save();
$this->entity = EntityTest::create([]);
$this->entity->{$this->fieldName}->value = $this->testValue;
}
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',
]);
}
}