function RdfMappingDefinitionTestCase::testAttributesInMarkup3 in Drupal 7
Create a random content type and node and ensure the default mapping for node is used.
File
- modules/
rdf/ rdf.test, line 337 - Tests for rdf.module.
Class
Code
function testAttributesInMarkup3() {
$type = $this
->drupalCreateContentType();
$node = $this
->drupalCreateNode(array(
'type' => $type->type,
));
$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.
$random_bundle_title = $this
->xpath("//div[@about='{$url}']/span[@property='dc:title' and @content='{$node->title}']");
$random_bundle_meta = $this
->xpath("//div[(@about='{$url}') and contains(@typeof, 'sioc:Item') and contains(@typeof, 'foaf:Document')]//span[contains(@property, 'dc:date') and contains(@property, 'dc:created') and @datatype='xsd:dateTime' and @content='{$isoDate}']");
$this
->assertTrue(!empty($random_bundle_title), 'Property dc:title is present in meta tag.');
$this
->assertTrue(!empty($random_bundle_meta), 'RDF type is present on post. Properties dc:date and dc:created are present on post date.');
}