You are here

public function RdfaAttributesTest::testDatatypeCallbackWithConverter in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php \Drupal\Tests\rdf\Kernel\RdfaAttributesTest::testDatatypeCallbackWithConverter()
  2. 10 core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php \Drupal\Tests\rdf\Kernel\RdfaAttributesTest::testDatatypeCallbackWithConverter()

Test attribute creation for mappings which use data converters.

File

core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php, line 79

Class

RdfaAttributesTest
Tests RDFa attribute generation from RDF mapping.

Namespace

Drupal\Tests\rdf\Kernel

Code

public function testDatatypeCallbackWithConverter() {
  $properties = [
    'schema:interactionCount',
  ];
  $data = "23";
  $content = "UserComments:23";
  $mapping = [
    'properties' => $properties,
    'datatype_callback' => [
      'callable' => 'Drupal\\rdf\\SchemaOrgDataConverter::interactionCount',
      'arguments' => [
        'interaction_type' => 'UserComments',
      ],
    ],
  ];
  $expected_attributes = [
    'property' => $properties,
    'content' => $content,
  ];
  $this
    ->_testAttributes($expected_attributes, $mapping, $data);
}