function RdfaAttributesTest::_testAttributes

Same name in other branches
  1. 8.9.x core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php \Drupal\Tests\rdf\Kernel\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/tests/src/Kernel/RdfaAttributesTest.php
Tests attribute creation for mappings which use 'datatype'.
RdfaAttributesTest::testDatatypeCallback in core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php
Tests attribute creation for mappings that override human-readable content.
RdfaAttributesTest::testDatatypeCallbackWithConverter in core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php
Tests attribute creation for mappings which use data converters.
RdfaAttributesTest::testProperty in core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php
Tests attribute creation for mappings which use 'property'.
RdfaAttributesTest::testRel in core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php
Tests attribute creation for mappings which use 'rel'.

File

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

Class

RdfaAttributesTest
Tests RDFa attribute generation from RDF mapping.

Namespace

Drupal\Tests\rdf\Kernel

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->assertEquals($expected_attributes, $attributes);
}

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