3 namespace Drupal\Tests\rdf\Kernel\Field;
5 use Drupal\entity_test\Entity\EntityTest;
8 * Tests RDFa output by text field formatters.
12 class StringFieldRdfaTest extends FieldRdfaTestBase {
17 protected $fieldType = 'string';
20 * The 'value' property value for testing.
24 protected $testValue = 'test_text_value';
27 * The 'summary' property value for testing.
31 protected $testSummary = 'test_summary_value';
33 protected function setUp() {
36 $this->createTestField();
39 $mapping = rdf_get_mapping('entity_test', 'entity_test');
40 $mapping->setFieldMapping($this->fieldName, [
41 'properties' => ['schema:text'],
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;
51 * Tests string formatters.
53 public function testStringFormatters() {
54 // Tests the string formatter.
55 $this->assertFormatterRdfa(['type' => 'string'], 'http://schema.org/text', ['value' => $this->testValue]);