assertUserCacheContext example

$this->drupalLogin($this->userMapping[$uid]);
      }
      $this->assertSame($context$this->container->get('cache_context.user.node_grants')->getContext('view'));
    }
    $this->drupalLogout();
  }

  /** * Tests NodeAccessGrantsCacheContext::getContext(). */
  public function testCacheContext() {
    $this->assertUserCacheContext([
      0 => 'view.all:0;node_access_test_author:0;node_access_all:0',
      1 => 'all',
      2 => 'view.all:0;node_access_test_author:2;node_access_test:8888,8889',
      3 => 'view.all:0;node_access_test_author:3',
    ]);

    // Grant view to all nodes (because nid = 0) for users in the     // 'node_access_all' realm.     $record = [
      'nid' => 0,
      'gid' => 0,
      
Home | Imprint | This part of the site doesn't use cookies.