You are here

public function XmlSitemapUserFunctionalTest::testBlockedUser in XML sitemap 8

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

Test sitemap link for a blocked user.

File

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

Class

XmlSitemapUserFunctionalTest
Tests the generation of user links.

Namespace

Drupal\Tests\xmlsitemap\Functional

Code

public function testBlockedUser() {
  $this
    ->assertSitemapLinkVisible('user', $this->normal_user
    ->id());

  // Reset the user entity access cache before updating the entity.
  $this->container
    ->get('entity_type.manager')
    ->getAccessControlHandler('user')
    ->resetCache();

  // Block the user.
  $this->normal_user
    ->block();
  $this->normal_user
    ->save();
  $this
    ->assertSitemapLinkNotVisible('user', $this->normal_user
    ->id());
}