function 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);
}

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