You are here

protected function SimpleSitemapViewsTestBase::setUp in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 modules/simple_sitemap_views/tests/src/Functional/SimpleSitemapViewsTestBase.php \Drupal\Tests\simple_sitemap_views\Functional\SimpleSitemapViewsTestBase::setUp()

Overrides SimplesitemapTestBase::setUp

File

modules/simple_sitemap_views/tests/src/Functional/SimpleSitemapViewsTestBase.php, line 61

Class

SimpleSitemapViewsTestBase
Defines a base class for Simple XML Sitemap (Views) functional testing.

Namespace

Drupal\Tests\simple_sitemap_views\Functional

Code

protected function setUp() {
  parent::setUp();
  $this->sitemapViews = $this->container
    ->get('simple_sitemap.views');
  $this->cron = $this->container
    ->get('cron');
  $this->sitemapVariant = 'default';
  $this->testView = Views::getView('simple_sitemap_views_test_view');
  $this->testView
    ->setDisplay('page_1');
  $this->testView2 = Views::getView('simple_sitemap_views_test_view');
  $this->testView2
    ->setDisplay('page_2');
  $sitemap_type = SimpleSitemapType::load('default_hreflang');
  $sitemap_type
    ->set('url_generators', array_merge($sitemap_type
    ->get('url_generators'), [
    'views',
  ]))
    ->save();
}