You are here

public function MetaInformationTest::getSiteMapDomElements in Thunder 8.3

Same name and namespace in other branches
  1. 8.5 tests/src/FunctionalJavascript/MetaInformationTest.php \Drupal\Tests\thunder\FunctionalJavascript\MetaInformationTest::getSiteMapDomElements()
  2. 8.2 tests/src/FunctionalJavascript/MetaInformationTest.php \Drupal\Tests\thunder\FunctionalJavascript\MetaInformationTest::getSiteMapDomElements()
  3. 8.4 tests/src/FunctionalJavascript/MetaInformationTest.php \Drupal\Tests\thunder\FunctionalJavascript\MetaInformationTest::getSiteMapDomElements()
  4. 6.2.x tests/src/FunctionalJavascript/MetaInformationTest.php \Drupal\Tests\thunder\FunctionalJavascript\MetaInformationTest::getSiteMapDomElements()
  5. 6.0.x tests/src/FunctionalJavascript/MetaInformationTest.php \Drupal\Tests\thunder\FunctionalJavascript\MetaInformationTest::getSiteMapDomElements()
  6. 6.1.x tests/src/FunctionalJavascript/MetaInformationTest.php \Drupal\Tests\thunder\FunctionalJavascript\MetaInformationTest::getSiteMapDomElements()

Get SiteMap dom elements by XPath.

Parameters

string $content: XML string content of Site Map.

string $xpathQuery: XPath to fetch elements from Site Map.

Return value

\DOMNodeList Returns list of elements matching provided XPath.

1 call to MetaInformationTest::getSiteMapDomElements()
MetaInformationTest::testSiteMap in tests/src/FunctionalJavascript/MetaInformationTest.php
Test Site Map for Article.

File

tests/src/FunctionalJavascript/MetaInformationTest.php, line 308

Class

MetaInformationTest
Testing of Meta Information.

Namespace

Drupal\Tests\thunder\FunctionalJavascript

Code

public function getSiteMapDomElements($content, $xpathQuery) {
  $domDoc = new \DOMDocument();
  $domDoc
    ->loadXML($content);
  $xpath = new \DOMXpath($domDoc);
  $xpath
    ->registerNamespace('sm', 'http://www.sitemaps.org/schemas/sitemap/0.9');
  $elements = $xpath
    ->query($xpathQuery);
  return $elements;
}