You are here

protected function RdfaAttributesTest::_testAttributes in Zircon Profile 8

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

Helper function to test attribute generation.

Parameters

array $expected_attributes: The expected return of rdf_rdfa_attributes.

array $field_mapping: The field mapping to merge into the RDF mapping config.

mixed $data: The data to pass into the datatype callback, if specified.

5 calls to RdfaAttributesTest::_testAttributes()
RdfaAttributesTest::testDatatype in core/modules/rdf/src/Tests/RdfaAttributesTest.php
Test attribute creation for mappings which use 'datatype'.
RdfaAttributesTest::testDatatypeCallback in core/modules/rdf/src/Tests/RdfaAttributesTest.php
Test attribute creation for mappings which override human-readable content.
RdfaAttributesTest::testDatatypeCallbackWithConverter in core/modules/rdf/src/Tests/RdfaAttributesTest.php
Test attribute creation for mappings which use data converters.
RdfaAttributesTest::testProperty in core/modules/rdf/src/Tests/RdfaAttributesTest.php
Test attribute creation for mappings which use 'property'.
RdfaAttributesTest::testRel in core/modules/rdf/src/Tests/RdfaAttributesTest.php
Test attribute creation for mappings which use 'rel'.

File

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

Class

RdfaAttributesTest
Tests RDFa attribute generation from RDF mapping.

Namespace

Drupal\rdf\Tests

Code

protected function _testAttributes($expected_attributes, $field_mapping, $data = NULL) {
  $mapping = rdf_get_mapping('node', 'article')
    ->setFieldMapping('field_test', $field_mapping)
    ->getPreparedFieldMapping('field_test');
  $attributes = rdf_rdfa_attributes($mapping, $data);
  ksort($expected_attributes);
  ksort($attributes);
  $this
    ->assertEqual($expected_attributes, $attributes);
}