$this->adminUser2 =
$this->
drupalCreateUser($this->perms
);
} /**
* Tests toolbar cache integration.
*/
public function testCacheIntegration() { $this->
installExtraModules(['csrf_test', 'dynamic_page_cache'
]);
$this->
drupalLogin($this->adminUser
);
$this->
drupalGet('test-page'
);
$this->
assertSession()->
responseHeaderEquals('X-Drupal-Dynamic-Cache', 'MISS'
);
$this->
assertCacheContexts(['session', 'user', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT
], 'Expected cache contexts found with CSRF token link.'
);
$this->
drupalGet('test-page'
);
$this->
assertSession()->
responseHeaderEquals('X-Drupal-Dynamic-Cache', 'HIT'
);
$this->
assertCacheContexts(['session', 'user', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT
], 'Expected cache contexts found with CSRF token link.'
);
} /**
* Tests toolbar cache contexts.
*/
public function testToolbarCacheContextsCaller() { // Test with default combination and permission to see toolbar.
$this->
assertToolbarCacheContexts(['user'
], 'Expected cache contexts found for default combination and permission to see toolbar.'
);