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 / StringFieldRdfaTest.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 text field formatters.
9  *
10  * @group rdf
11  */
12 class StringFieldRdfaTest extends FieldRdfaTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   protected $fieldType = 'string';
18
19   /**
20    * The 'value' property value for testing.
21    *
22    * @var string
23    */
24   protected $testValue = 'test_text_value';
25
26   /**
27    * The 'summary' property value for testing.
28    *
29    * @var string
30    */
31   protected $testSummary = 'test_summary_value';
32
33   protected function setUp() {
34     parent::setUp();
35
36     $this->createTestField();
37
38     // Add the mapping.
39     $mapping = rdf_get_mapping('entity_test', 'entity_test');
40     $mapping->setFieldMapping($this->fieldName, [
41       'properties' => ['schema:text'],
42     ])->save();
43
44     // Set up test entity.
45     $this->entity = EntityTest::create();
46     $this->entity->{$this->fieldName}->value = $this->testValue;
47     $this->entity->{$this->fieldName}->summary = $this->testSummary;
48   }
49
50   /**
51    * Tests string formatters.
52    */
53   public function testStringFormatters() {
54     // Tests the string formatter.
55     $this->assertFormatterRdfa(['type' => 'string'], 'http://schema.org/text', ['value' => $this->testValue]);
56   }
57
58 }