comparison core/modules/rdf/tests/src/Functional/GetRdfNamespacesTest.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
20 20
21 /** 21 /**
22 * Tests getting RDF namespaces. 22 * Tests getting RDF namespaces.
23 */ 23 */
24 public function testGetRdfNamespaces() { 24 public function testGetRdfNamespaces() {
25 // Fetches the front page and extracts RDFa 1.1 prefixes.
26 $this->drupalGet('');
27
28 // We have to use the find() method on the driver directly because //html is
29 // prepended to all xpath queries otherwise.
30 $driver = $this->getSession()->getDriver();
31
32 $element = $driver->find('//html[contains(@prefix, "rdfs: http://www.w3.org/2000/01/rdf-schema#")]');
33 $this->assertCount(1, $element, 'A prefix declared once is displayed.');
34
35 $element = $driver->find('//html[contains(@prefix, "foaf: http://xmlns.com/foaf/0.1/")]');
36 $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.');
37
38 $element = $driver->find('//html[contains(@prefix, "foaf1: http://xmlns.com/foaf/0.1/")]');
39 $this->assertCount(1, $element, 'Two prefixes can be assigned the same namespace.');
40
41 $element = $driver->find('//html[contains(@prefix, "dc: http://purl.org/dc/terms/")]');
42 $this->assertCount(1, $element, 'When a prefix has conflicting namespaces, the first declared one is used.');
43
25 // Get all RDF namespaces. 44 // Get all RDF namespaces.
26 $ns = rdf_get_namespaces(); 45 $ns = rdf_get_namespaces();
27 46
28 $this->assertEqual($ns['rdfs'], 'http://www.w3.org/2000/01/rdf-schema#', 'A prefix declared once is included.'); 47 $this->assertEqual($ns['rdfs'], 'http://www.w3.org/2000/01/rdf-schema#', 'A prefix declared once is included.');
29 $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.'); 48 $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.');