You are here

protected function SitemapTaxonomyTestBase::setUp in Sitemap 8

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

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides TaxonomyTestBase::setUp

2 calls to SitemapTaxonomyTestBase::setUp()
SitemapTaxonomyTermsRssTest::setUp in src/Tests/SitemapTaxonomyTermsRssTest.php
Sets up a Drupal site for running functional and integration tests.
SitemapTaxonomyTermsTest::setUp in src/Tests/SitemapTaxonomyTermsTest.php
Sets up a Drupal site for running functional and integration tests.
2 methods override SitemapTaxonomyTestBase::setUp()
SitemapTaxonomyTermsRssTest::setUp in src/Tests/SitemapTaxonomyTermsRssTest.php
Sets up a Drupal site for running functional and integration tests.
SitemapTaxonomyTermsTest::setUp in src/Tests/SitemapTaxonomyTermsTest.php
Sets up a Drupal site for running functional and integration tests.

File

src/Tests/SitemapTaxonomyTestBase.php, line 46

Class

SitemapTaxonomyTestBase
Base class for some Sitemap test cases.

Namespace

Drupal\sitemap\Tests

Code

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

  // 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();
  $edit = [
    "show_vocabularies[{$vid}]" => $vid,
  ];
  $this
    ->drupalPostForm('admin/config/search/sitemap', $edit, t('Save configuration'));
}