You are here

function RdfaAttributesTest::testDatatypeCallback 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::testDatatypeCallback()

Test attribute creation for mappings which override human-readable content.

File

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

Class

RdfaAttributesTest
Tests RDFa attribute generation from RDF mapping.

Namespace

Drupal\rdf\Tests

Code

function testDatatypeCallback() {
  $properties = array(
    'dc:created',
  );
  $datatype = 'xsd:dateTime';
  $date = 1252750327;
  $iso_date = date('c', $date);
  $mapping = array(
    'datatype' => $datatype,
    'properties' => $properties,
    'datatype_callback' => array(
      'callable' => 'date_iso8601',
    ),
  );
  $expected_attributes = array(
    'datatype' => $datatype,
    'property' => $properties,
    'content' => $iso_date,
  );
  $this
    ->_testAttributes($expected_attributes, $mapping, $date);
}