diff options
Diffstat (limited to 'modules/simpletest/tests/common.test')
-rw-r--r-- | modules/simpletest/tests/common.test | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index 9eaefe168..cdec4ed98 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -1891,3 +1891,35 @@ class DrupalJSONTest extends DrupalUnitTestCase { $this->assertIdentical($source, $json_decoded, t('Encoding structured data to JSON and decoding back results in the original data.')); } } + +/** + * Tests for RDF namespaces XML serialization. + */ +class DrupalGetRdfNamespacesTestCase extends DrupalWebTestCase { + public static function getInfo() { + return array( + 'name' => 'RDF namespaces XML serialization tests', + 'description' => 'Confirm that the serialization of RDF namespaces via drupal_get_rdf_namespaces() is output and parsed correctly in the XHTML document.', + 'group' => 'System', + ); + } + + function setUp() { + parent::setUp('rdf', 'rdf_test'); + } + + /** + * Test RDF namespaces. + */ + function testGetRdfNamespaces() { + // Fetches the front page and extracts XML namespaces. + $this->drupalGet(''); + $xml = new SimpleXMLElement($this->content); + $ns = $xml->getDocNamespaces(); + + $this->assertEqual($ns['owl'], 'http://www.w3.org/2002/07/owl#', t('A prefix declared once is displayed.')); + $this->assertEqual($ns['foaf'], 'http://xmlns.com/foaf/0.1/', t('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/', t('Two prefixes can be assigned the same namespace.')); + $this->assertTrue(!isset($ns['dc']), t('A prefix with conflicting namespaces is discarded.')); + } +} |