Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / rdf / tests / src / Functional / GetRdfNamespacesTest.php
index 5d31d3ac23922460f9376c7579d51697bb60329e..0b162a4a905556f5b485e4c12af43f0624635960 100644 (file)
@@ -22,6 +22,25 @@ class GetRdfNamespacesTest extends BrowserTestBase {
    * Tests getting RDF namespaces.
    */
   public function testGetRdfNamespaces() {
+    // Fetches the front page and extracts RDFa 1.1 prefixes.
+    $this->drupalGet('');
+
+    // We have to use the find() method on the driver directly because //html is
+    // prepended to all xpath queries otherwise.
+    $driver = $this->getSession()->getDriver();
+
+    $element = $driver->find('//html[contains(@prefix, "rdfs: http://www.w3.org/2000/01/rdf-schema#")]');
+    $this->assertCount(1, $element, 'A prefix declared once is displayed.');
+
+    $element = $driver->find('//html[contains(@prefix, "foaf: http://xmlns.com/foaf/0.1/")]');
+    $this->assertCount(1, $element, 'The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.');
+
+    $element = $driver->find('//html[contains(@prefix, "foaf1: http://xmlns.com/foaf/0.1/")]');
+    $this->assertCount(1, $element, 'Two prefixes can be assigned the same namespace.');
+
+    $element = $driver->find('//html[contains(@prefix, "dc: http://purl.org/dc/terms/")]');
+    $this->assertCount(1, $element, 'When a prefix has conflicting namespaces, the first declared one is used.');
+
     // Get all RDF namespaces.
     $ns = rdf_get_namespaces();