Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / rdf / tests / src / Kernel / Field / DateTimeFieldRdfaTest.php
1 <?php
2
3 namespace Drupal\Tests\rdf\Kernel\Field;
4
5 use Drupal\entity_test\Entity\EntityTest;
6
7 /**
8  * Tests RDFa output by datetime field formatters.
9  *
10  * @group rdf
11  */
12 class DateTimeFieldRdfaTest extends FieldRdfaTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   protected $fieldType = 'datetime';
18
19   /**
20    * The 'value' property value for testing.
21    *
22    * @var string
23    */
24   protected $testValue = '2014-01-28T06:01:01';
25
26   /**
27   * {@inheritdoc}
28   */
29   public static $modules = ['datetime'];
30
31   protected function setUp() {
32     parent::setUp();
33
34     $this->createTestField();
35
36     // Add the mapping.
37     $mapping = rdf_get_mapping('entity_test', 'entity_test');
38     $mapping->setFieldMapping($this->fieldName, [
39       'properties' => ['schema:dateCreated'],
40     ])->save();
41
42     // Set up test entity.
43     $this->entity = EntityTest::create([]);
44     $this->entity->{$this->fieldName}->value = $this->testValue;
45   }
46
47   /**
48    * Tests the default formatter.
49    */
50   public function testDefaultFormatter() {
51     $this->assertFormatterRdfa(['type' => 'datetime_default'], 'http://schema.org/dateCreated', ['value' => $this->testValue . 'Z', 'type' => 'literal', 'datatype' => 'http://www.w3.org/2001/XMLSchema#dateTime']);
52   }
53
54 }