You are here

protected function XmlSitemapMultilingualNodeTest::setUp in XML sitemap 2.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/XmlSitemapMultilingualNodeTest.php \Drupal\Tests\xmlsitemap\Functional\XmlSitemapMultilingualNodeTest::setUp()

Set up an administrative user account and testing keys.

Overrides XmlSitemapMultilingualTestBase::setUp

File

tests/src/Functional/XmlSitemapMultilingualNodeTest.php, line 24

Class

XmlSitemapMultilingualNodeTest
Tests the generation of multilingual nodes.

Namespace

Drupal\Tests\xmlsitemap\Functional

Code

protected function setUp() {
  parent::setUp();
  $this->admin_user = $this
    ->drupalCreateUser([
    'administer nodes',
    'administer languages',
    'administer content types',
    'access administration pages',
    'create page content',
    'edit own page content',
  ]);
  $this
    ->drupalLogin($this->admin_user);
  xmlsitemap_link_bundle_enable('node', 'article');
  xmlsitemap_link_bundle_enable('node', 'page');

  // Allow anonymous user to view user profiles.
  $user_role = Role::load(AccountInterface::ANONYMOUS_ROLE);
  $user_role
    ->grantPermission('access content');
  $user_role
    ->save();

  // Set "Basic page" content type to use multilingual support.
  $edit = [
    'language_configuration[language_alterable]' => TRUE,
  ];
  $this
    ->drupalPostForm('admin/structure/types/manage/page', $edit, 'Save content type');
  $this
    ->assertSession()
    ->responseContains((string) new FormattableMarkup('The content type %content_type has been updated.', [
    '%content_type' => 'Basic page',
  ]));
}