You are here

protected function SitemapTaxonomyTestBase::createNestedTerms in Sitemap 2.0.x

Same name and namespace in other branches
  1. 8.2 src/Tests/SitemapTaxonomyTestBase.php \Drupal\sitemap\Tests\SitemapTaxonomyTestBase::createNestedTerms()

Create taxonomy terms.

Parameters

\Drupal\taxonomy\Entity\Vocabulary $vocabulary: Taxonomy vocabulary.

Return value

array List of tags.

Throws

\Exception

3 calls to SitemapTaxonomyTestBase::createNestedTerms()
SitemapTaxonomyTermsRssTest::testRssFeedDepth in src/Tests/SitemapTaxonomyTermsRssTest.php
Tests RSS feed depth.
SitemapTaxonomyTermsTest::testNestedTermLinks in src/Tests/SitemapTaxonomyTermsTest.php
Tests the nested term link settings.
SitemapTaxonomyTermsTest::testVocabularyDepth in src/Tests/SitemapTaxonomyTermsTest.php
Tests vocabulary depth settings.

File

src/Tests/SitemapTaxonomyTestBase.php, line 114

Class

SitemapTaxonomyTestBase
Base class for some Sitemap test cases.

Namespace

Drupal\sitemap\Tests

Code

protected function createNestedTerms(Vocabulary $vocabulary) {
  $term0 = $this
    ->createTerm($vocabulary);
  $term1 = $this
    ->createTerm($vocabulary, [
    'parent' => $term0
      ->id(),
  ]);
  $term2 = $this
    ->createTerm($vocabulary, [
    'parent' => $term1
      ->id(),
  ]);
  return [
    $term0,
    $term1,
    $term2,
  ];
}