You are here

protected function NumberFieldRdfaTest::createTestEntity in Drupal 9

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

Creates the RDF mapping for the field.

8 calls to NumberFieldRdfaTest::createTestEntity()
NumberFieldRdfaTest::testDecimalFormatter in core/modules/rdf/tests/src/Kernel/Field/NumberFieldRdfaTest.php
Tests the decimal formatter.
NumberFieldRdfaTest::testDecimalFormatterWithSettings in core/modules/rdf/tests/src/Kernel/Field/NumberFieldRdfaTest.php
Tests the decimal formatter with settings.
NumberFieldRdfaTest::testFloatFormatter in core/modules/rdf/tests/src/Kernel/Field/NumberFieldRdfaTest.php
Tests the float formatter.
NumberFieldRdfaTest::testFloatFormatterWithScale in core/modules/rdf/tests/src/Kernel/Field/NumberFieldRdfaTest.php
Tests the float formatter with a scale. Scale is not exercised.
NumberFieldRdfaTest::testFloatFormatterWithScaleExercised in core/modules/rdf/tests/src/Kernel/Field/NumberFieldRdfaTest.php
Tests the float formatter with a scale. Scale is exercised.

... See full list

File

core/modules/rdf/tests/src/Kernel/Field/NumberFieldRdfaTest.php, line 192

Class

NumberFieldRdfaTest
Tests RDFa output by number field formatters.

Namespace

Drupal\Tests\rdf\Kernel\Field

Code

protected function createTestEntity($testValue) {

  // Add the mapping.
  $mapping = rdf_get_mapping('entity_test', 'entity_test');
  $mapping
    ->setFieldMapping($this->fieldName, [
    'properties' => [
      'schema:baseSalary',
    ],
  ])
    ->save();

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