/** * {@inheritdoc} */ protected function getDefaultCacheContexts() { $defaults = parent::getDefaultCacheContexts(); // @see \Drupal\node\Controller\NodeViewController::view() $defaults[] = 'user.roles:anonymous'; return $defaults; }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); // Give anonymous users permission to view user profiles, so that we can // verify the cache tags of cached versions of user profile pages. $user_role = Role::load(RoleInterface::ANONYMOUS_ID); $user_role->grantPermission('access user profiles'); $user_role->save(); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); // Give anonymous users permission to access feeds, so that we can verify // the cache tags of cached versions of feeds. $user_role = Role::load(DRUPAL_ANONYMOUS_RID); $user_role->grantPermission('access news feeds'); $user_role->save(); }
/** * {@inheritdoc} */ public function setUp() { parent::setUp(); // Give anonymous users permission to view user profiles, so that we can // verify the cache tags of cached versions of user profile pages. $user_role = entity_load('user_role', DRUPAL_ANONYMOUS_RID); $user_role->grantPermission('access user profiles'); $user_role->save(); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); // Give anonymous users permission to view nodes, so that we can verify the // cache tags of cached versions of node pages. $user_role = Role::load(DRUPAL_ANONYMOUS_RID); $user_role->grantPermission('acess content'); $user_role->save(); }