function DrupalGetRdfNamespacesTestCase::testGetRdfNamespaces

Test RDF namespaces.

File

modules/simpletest/tests/common.test, line 3169

Class

DrupalGetRdfNamespacesTestCase
Tests for RDF namespaces XML serialization.

Code

function testGetRdfNamespaces() {
    // Fetches the front page and extracts XML namespaces.
    $this->drupalGet('');
    $xml = new SimpleXMLElement($this->content);
    $ns = $xml->getDocNamespaces();
    $this->assertEqual($ns['rdfs'], 'http://www.w3.org/2000/01/rdf-schema#', 'A prefix declared once is displayed.');
    $this->assertEqual($ns['foaf'], 'http://xmlns.com/foaf/0.1/', 'The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.');
    $this->assertEqual($ns['foaf1'], 'http://xmlns.com/foaf/0.1/', 'Two prefixes can be assigned the same namespace.');
    $this->assertTrue(!isset($ns['dc']), 'A prefix with conflicting namespaces is discarded.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.