diff --git a/core/modules/rdf/tests/src/Functional/GetNamespacesTest.php b/core/modules/rdf/tests/src/Functional/GetNamespacesTest.php index 4ced14d..abdecc2 100644 --- a/core/modules/rdf/tests/src/Functional/GetNamespacesTest.php +++ b/core/modules/rdf/tests/src/Functional/GetNamespacesTest.php @@ -26,22 +26,23 @@ public function testGetRdfNamespaces() { // Fetches the front page and extracts RDFa 1.1 prefixes. $this->drupalGet(''); - $element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', [ + $element = $this->xpath('//*[ancestor::html[contains(@prefix, :prefix_binding)]]', [ ':prefix_binding' => 'rdfs: http://www.w3.org/2000/01/rdf-schema#', ]); + $this->assertTrue(!empty($element[0]->getText()), 'A prefix declared once is displayed.'); - $element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', [ + $element = $this->xpath('//*[ancestor::html[contains(@prefix, :prefix_binding)]]', [ ':prefix_binding' => 'foaf: http://xmlns.com/foaf/0.1/', ]); $this->assertTrue(!empty($element[0]->getText()), '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)]', [ + $element = $this->xpath('//*[ancestor::html[contains(@prefix, :prefix_binding)]]', [ ':prefix_binding' => 'foaf1: http://xmlns.com/foaf/0.1/', ]); $this->assertTrue(!empty($element[0]->getText()), 'Two prefixes can be assigned the same namespace.'); - $element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', [ + $element = $this->xpath('//*[ancestor::html[contains(@prefix, :prefix_binding)]]', [ ':prefix_binding' => 'dc: http://purl.org/dc/terms/', ]); $this->assertTrue(!empty($element[0]->getText()), 'When a prefix has conflicting namespaces, the first declared one is used.');