function RdfMappingDefinitionTestCase::testAttributesInMarkup1

Create a node of type blog and test whether the RDF mapping defined for this node type in rdf_test.module is used in the node page.

File

drupal/modules/rdf/rdf.test, line 296
Tests for rdf.module.

Class

RdfMappingDefinitionTestCase

Code

function testAttributesInMarkup1() {
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'blog',
  ));
  $isoDate = date('c', $node->changed);
  $url = url('node/' . $node->nid);
  $this
    ->drupalGet('node/' . $node->nid);

  // Ensure the default bundle mapping for node is used. These attributes come
  // from the node default bundle definition.
  $blog_title = $this
    ->xpath("//div[@about='{$url}']/span[@property='dc:title' and @content='{$node->title}']");
  $blog_meta = $this
    ->xpath("//div[(@about='{$url}') and (@typeof='sioct:Weblog')]//span[contains(@property, 'dc:date') and contains(@property, 'dc:created') and @datatype='xsd:dateTime' and @content='{$isoDate}']");
  $this
    ->assertTrue(!empty($blog_title), 'Property dc:title is present in meta tag.');
  $this
    ->assertTrue(!empty($blog_meta), 'RDF type is present on post. Properties dc:date and dc:created are present on post date.');
}