function FieldRdfaDatatypeCallbackTest::setUp

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

Overrides FieldRdfaTestBase::setUp

File

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

Class

FieldRdfaDatatypeCallbackTest
Tests the RDFa output of a text field formatter with a datatype callback.

Namespace

Drupal\Tests\rdf\Kernel\Field

Code

protected function setUp() {
    parent::setUp();
    $this->createTestField();
    $this->installConfig([
        'filter',
    ]);
    // Add the mapping.
    $mapping = rdf_get_mapping('entity_test', 'entity_test');
    $mapping->setFieldMapping($this->fieldName, [
        'properties' => [
            'schema:interactionCount',
        ],
        'datatype_callback' => [
            'callable' => 'Drupal\\rdf_test\\TestDataConverter::convertFoo',
        ],
    ])
        ->save();
    // Set up test values.
    $this->testValue = $this->randomMachineName();
    $this->entity = EntityTest::create();
    $this->entity->{$this->fieldName}->value = $this->testValue;
    $this->entity
        ->save();
    $this->uri = $this->getAbsoluteUri($this->entity);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.