You are here

protected function XmlSitemapTestBase::addSitemapLink in XML sitemap 8

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

Add Sitemap Link.

6 calls to XmlSitemapTestBase::addSitemapLink()
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.
XmlSitemapUnitTest::testGetChunkCount in tests/src/Functional/XmlSitemapUnitTest.php
Tests for xmlsitemap_get_chunk_count().
XmlSitemapUnitTest::testLinkDelete in tests/src/Functional/XmlSitemapUnitTest.php
Tests for XmlSitemapLinkStorage::delete().
XmlSitemapUnitTest::testMinimumLifetime in tests/src/Functional/XmlSitemapUnitTest.php
Test that the sitemap will not be genereated before the lifetime expires.

... See full list

File

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

Class

XmlSitemapTestBase
Helper test class with some added functions for testing.

Namespace

Drupal\Tests\xmlsitemap\Functional

Code

protected function addSitemapLink(array $link = []) {
  $last_id =& drupal_static(__FUNCTION__, 1);
  $link += [
    'type' => 'testing',
    'subtype' => '',
    'id' => $last_id,
    'access' => 1,
    'status' => 1,
  ];

  // Make the default path easier to read than a random string.
  $link += [
    'loc' => '/' . $link['type'] . '-' . $link['id'],
  ];
  $last_id = max($last_id, $link['id']) + 1;
  $this->linkStorage
    ->save($link);
  return $link;
}