You are here

function RdfaAttributesTest::testDatatypeCallbackWithConverter in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/rdf/src/Tests/RdfaAttributesTest.php \Drupal\rdf\Tests\RdfaAttributesTest::testDatatypeCallbackWithConverter()

Test attribute creation for mappings which use data converters.

File

core/modules/rdf/src/Tests/RdfaAttributesTest.php, line 85
Contains \Drupal\rdf\Tests\RdfaAttributesTest.

Class

RdfaAttributesTest
Tests RDFa attribute generation from RDF mapping.

Namespace

Drupal\rdf\Tests

Code

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