X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Frdf%2Fsrc%2FTests%2FGetNamespacesTest.php;fp=web%2Fcore%2Fmodules%2Frdf%2Fsrc%2FTests%2FGetNamespacesTest.php;h=ca46c5cd794c9b0137c0187fddbc8408a436b3f1;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/rdf/src/Tests/GetNamespacesTest.php b/web/core/modules/rdf/src/Tests/GetNamespacesTest.php new file mode 100644 index 000000000..ca46c5cd7 --- /dev/null +++ b/web/core/modules/rdf/src/Tests/GetNamespacesTest.php @@ -0,0 +1,50 @@ +drupalGet(''); + + $element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', [ + ':prefix_binding' => 'rdfs: http://www.w3.org/2000/01/rdf-schema#', + ]); + $this->assertTrue(!empty($element), 'A prefix declared once is displayed.'); + + $element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', [ + ':prefix_binding' => 'foaf: http://xmlns.com/foaf/0.1/', + ]); + $this->assertTrue(!empty($element), 'The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.'); + + $element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', [ + ':prefix_binding' => 'foaf1: http://xmlns.com/foaf/0.1/', + ]); + $this->assertTrue(!empty($element), 'Two prefixes can be assigned the same namespace.'); + + $element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', [ + ':prefix_binding' => 'dc: http://purl.org/dc/terms/', + ]); + $this->assertTrue(!empty($element), 'When a prefix has conflicting namespaces, the first declared one is used.'); + } + +}