You are here

public function XmlSitemapEntityFunctionalTest::testUserCannotViewEntity in XML sitemap 2.x

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

Test User Cannot View Entity.

File

tests/src/Functional/XmlSitemapEntityFunctionalTest.php, line 126

Class

XmlSitemapEntityFunctionalTest
Tests the generation of a random content entity links.

Namespace

Drupal\Tests\xmlsitemap\Functional

Code

public function testUserCannotViewEntity() {

  // Disallow anonymous users to view test entities.
  $user_role = Role::load(AccountInterface::ANONYMOUS_ROLE);
  $user_role
    ->revokePermission('view test entity');
  $user_role
    ->save();
  xmlsitemap_link_bundle_enable('entity_test_mul', 'entity_test_mul');
  $entity = EntityTestMul::create();
  $entity
    ->save();
  $this
    ->assertSitemapLinkValues('entity_test_mul', $entity
    ->id(), [
    'status' => 0,
    'priority' => 0.5,
    'changefreq' => 0,
    'access' => 0,
  ]);
}