You are here

protected function RdfaAttributesTest::_testAttributes in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php \Drupal\Tests\rdf\Kernel\RdfaAttributesTest::_testAttributes()
  2. 9 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.

File

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

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