12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- class RdfExampleRdfaMarkupTestCase extends DrupalWebTestCase {
-
- public static function getInfo() {
- return array(
- 'name' => 'RDFa markup',
- 'description' => 'Test RDFa markup generation.',
- 'group' => 'Examples',
- );
- }
-
- public function setUp() {
- parent::setUp('rdf', 'field_test', 'rdf_example');
- }
-
- public function testAttributesInMarkup() {
- $node = $this->drupalCreateNode(array('type' => 'recipe'));
- $this->drupalGet('node/' . $node->nid);
- $iso_date = date('c', $node->changed);
- $url = url('node/' . $node->nid);
-
-
- $recipe_title = $this->xpath("//span[contains(@property, 'dc:title') and contains(@property, 'v:name') and @content='$node->title']");
- $this->assertTrue(!empty($recipe_title), 'Title is exposed with dc:title and v:name in meta element.');
-
-
- $recipe_meta = $this->xpath("//div[(@about='$url') and (@typeof='v:Recipe')]//span[contains(@property, 'dc:date') and contains(@property, 'dc:created') and @datatype='xsd:dateTime' and @content='$iso_date']");
- $this->assertTrue(!empty($recipe_meta), 'RDF type is present on post. Properties dc:date and dc:created are present on post date.');
- }
- }
|