You are here

protected function SitemapTaxonomyTestBase::setUp in Sitemap 2.0.x

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

Overrides BrowserTestBase::setUp

1 call to SitemapTaxonomyTestBase::setUp()
SitemapTaxonomyTermsRssTest::setUp in src/Tests/SitemapTaxonomyTermsRssTest.php
1 method overrides SitemapTaxonomyTestBase::setUp()
SitemapTaxonomyTermsRssTest::setUp in src/Tests/SitemapTaxonomyTermsRssTest.php

File

src/Tests/SitemapTaxonomyTestBase.php, line 59

Class

SitemapTaxonomyTestBase
Base class for some Sitemap test cases.

Namespace

Drupal\sitemap\Tests

Code

protected function setUp() {
  parent::setUp();

  // Ensure the Article node type.
  if ($this->profile != 'standard') {
    $this
      ->drupalCreateContentType([
      'type' => 'article',
      'name' => 'Article',
    ]);
  }

  // Create a vocabulary.
  $this->vocabulary = $this
    ->createVocabulary();

  // Create user, then login.
  $this->user = $this
    ->drupalCreateUser([
    'administer sitemap',
    'access sitemap',
    'administer nodes',
    'create article content',
    'administer taxonomy',
  ]);
  $this
    ->drupalLogin($this->user);

  // Configure the sitemap to display the vocabulary.
  $vid = $this->vocabulary
    ->id();
  $this
    ->saveSitemapForm([
    "plugins[vocabulary:{$vid}][enabled]" => TRUE,
  ]);
}