You are here

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

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

Overrides XmlSitemapTestBase::setUp

File

tests/src/Functional/XmlSitemapUserFunctionalTest.php, line 23

Class

XmlSitemapUserFunctionalTest
Tests the generation of user links.

Namespace

Drupal\Tests\xmlsitemap\Functional

Code

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

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

  // Enable XML Sitemap settings for users.
  xmlsitemap_link_bundle_settings_save('user', 'user', [
    'status' => 1,
    'priority' => XMLSITEMAP_PRIORITY_DEFAULT,
  ]);

  // Create the users.
  $this->admin_user = $this
    ->drupalCreateUser([
    'administer users',
    'administer permissions',
    'administer xmlsitemap',
  ]);
  $this->normal_user = $this
    ->drupalCreateUser([
    'access content',
  ]);
}