You are here

protected function XmlSitemapTestBase::drupalGetSitemap in XML sitemap 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/XmlSitemapTestBase.php \Drupal\Tests\xmlsitemap\Functional\XmlSitemapTestBase::drupalGetSitemap()

Retrieves an XML sitemap.

Parameters

array $context: An optional array of the XML sitemap's context.

array $options: Options to be forwarded to Url::fromUri(). These values will be merged with, but always override $sitemap->uri['options'].

array $headers: An array containing additional HTTP request headers, each formatted as "name: value".

Return value

string The retrieved HTML string, also available as $this->drupalGetContent()

6 calls to XmlSitemapTestBase::drupalGetSitemap()
XmlSitemapEntityFunctionalTest::testEntityLinkBundleSettingsForm in tests/src/Functional/XmlSitemapEntityFunctionalTest.php
Test Entity Link Bundle Settings Form.
XmlSitemapFunctionalTest::testBaseURL in tests/src/Functional/XmlSitemapFunctionalTest.php
Test base URL functionality.
XmlSitemapFunctionalTest::testSitemapCaching in tests/src/Functional/XmlSitemapFunctionalTest.php
Test the sitemap file caching.
XmlSitemapMultilingualTest::testLanguageSelection in tests/src/Functional/XmlSitemapMultilingualTest.php
Test Language Selection.
XmlSitemapUnitTest::testDuplicatePaths in tests/src/Functional/XmlSitemapUnitTest.php
Test that duplicate paths are skipped during generation.

... See full list

File

tests/src/Functional/XmlSitemapTestBase.php, line 176

Class

XmlSitemapTestBase
Helper test class with some added functions for testing.

Namespace

Drupal\Tests\xmlsitemap\Functional

Code

protected function drupalGetSitemap(array $context = [], array $options = [], array $headers = []) {
  $sitemap = XmlSitemap::loadByContext($context);
  if (!$sitemap) {
    return $this
      ->fail('Could not load sitemap by context.');
  }
  $uri = xmlsitemap_sitemap_uri($sitemap);
  return $this
    ->drupalGet($uri['path'], $options + $uri['options'], $headers);
}