You are here

protected function EmailFieldRdfaTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/rdf/tests/src/Kernel/Field/EmailFieldRdfaTest.php \Drupal\Tests\rdf\Kernel\Field\EmailFieldRdfaTest::setUp()

Set the default field storage backend for fields created during tests.

Overrides FieldKernelTestBase::setUp

File

core/modules/rdf/tests/src/Kernel/Field/EmailFieldRdfaTest.php, line 24

Class

EmailFieldRdfaTest
Tests RDFa output by email field formatters.

Namespace

Drupal\Tests\rdf\Kernel\Field

Code

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:email',
    ],
  ])
    ->save();

  // Set up test values.
  $this->testValue = 'test@example.com';
  $this->entity = EntityTest::create([]);
  $this->entity->{$this->fieldName}->value = $this->testValue;
}