You are here

protected function FieldRdfaDatatypeCallbackTest::setUp in Zircon Profile 8

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

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

Overrides FieldRdfaTestBase::setUp

File

core/modules/rdf/src/Tests/Field/FieldRdfaDatatypeCallbackTest.php, line 26
Contains \Drupal\rdf\Tests\Field\FieldRdfaDatatypeCallbackTest.

Class

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

Namespace

Drupal\rdf\Tests\Field

Code

protected function setUp() {
  parent::setUp();
  $this
    ->createTestField();
  $this
    ->installConfig(array(
    'filter',
  ));

  // Add the mapping.
  $mapping = rdf_get_mapping('entity_test', 'entity_test');
  $mapping
    ->setFieldMapping($this->fieldName, array(
    'properties' => array(
      'schema:interactionCount',
    ),
    'datatype_callback' => array(
      'callable' => 'Drupal\\rdf\\Tests\\Field\\TestDataConverter::convertFoo',
    ),
  ))
    ->save();

  // Set up test values.
  $this->testValue = $this
    ->randomMachineName();
  $this->entity = entity_create('entity_test');
  $this->entity->{$this->fieldName}->value = $this->testValue;
  $this->entity
    ->save();
  $this->uri = $this
    ->getAbsoluteUri($this->entity);
}