Issue #3079595 by jhodgdon: The Help breadcrumb builder does not set cache contexts

merge-requests/55/head
Lee Rowlands 2019-09-10 07:52:25 +10:00
parent 6a2d67db47
commit 00d8dafd76
No known key found for this signature in database
GPG Key ID: 2B829A3DF9204DC4
2 changed files with 13 additions and 2 deletions

View File

@ -43,6 +43,7 @@ class HelpBreadcrumbBuilder implements BreadcrumbBuilderInterface {
*/
public function build(RouteMatchInterface $route_match) {
$breadcrumb = new Breadcrumb();
$breadcrumb->addCacheContexts(['url.path.parent']);
$breadcrumb->addLink(Link::createFromRoute($this->t('Home'), '<front>'));
$breadcrumb->addLink(Link::createFromRoute($this->t('Administration'), 'system.admin'));
$breadcrumb->addLink(Link::createFromRoute($this->t('Help'), 'help.main'));

View File

@ -66,6 +66,7 @@ class HelpTopicTest extends BrowserTestBase {
'access administration pages',
'view the administration theme',
'administer permissions',
'administer site configuration',
]);
$this->anyUser = $this->createUser([]);
}
@ -235,12 +236,21 @@ class HelpTopicTest extends BrowserTestBase {
// Verify Help Topics administration breadcrumbs.
$trail = [
'' => 'Home',
'admin' => t('Administration'),
'admin/help' => t('Help'),
'admin' => 'Administration',
'admin/help' => 'Help',
];
$this->assertBreadcrumb('admin/help/topic/help_topics_test.test', $trail);
// Ensure we are on the expected help topic page.
$this->assertSession()->pageTextContains('Also there should be a related topic link below to the Help module topic page and the linked topic.');
// Verify that another page does not have the help breadcrumb.
$trail = [
'' => 'Home',
'admin' => 'Administration',
'admin/config' => 'Configuration',
'admin/config/system' => 'System',
];
$this->assertBreadcrumb('admin/config/system/site-information', $trail);
}
}