function MappingDefinitionTest::testTaxonomyTermRdfaAttributes

Creates a random term and ensures the right RDFa markup is used.

File

drupal/core/modules/rdf/lib/Drupal/rdf/Tests/MappingDefinitionTest.php, line 145
Definition of Drupal\rdf\Tests\MappingDefinitionTest.

Class

MappingDefinitionTest
Tests the RDF mapping definition functionality.

Namespace

Drupal\rdf\Tests

Code

function testTaxonomyTermRdfaAttributes() {
  $vocabulary = $this
    ->createVocabulary();
  $term = $this
    ->createTerm($vocabulary);

  // Views the term and checks that the RDFa markup is correct.
  $this
    ->drupalGet('taxonomy/term/' . $term->tid);
  $term_url = url('taxonomy/term/' . $term->tid);
  $term_label = $term
    ->label();
  $term_rdfa_meta = $this
    ->xpath('//meta[@typeof="skos:Concept" and @about=:term-url and contains(@property, "rdfs:label") and contains(@property, "skos:prefLabel") and @content=:term-label]', array(
    ':term-url' => $term_url,
    ':term-label' => $term_label,
  ));
  $this
    ->assertTrue(!empty($term_rdfa_meta), 'RDFa markup found on term page.');
}