function LayoutBuilderTest::testBreadcrumb
Same name in other branches
- 8.9.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testBreadcrumb()
- 10 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testBreadcrumb()
- 11.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testBreadcrumb()
Tests the expected breadcrumbs of the Layout Builder UI.
File
-
core/
modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderTest.php, line 1368
Class
- LayoutBuilderTest
- Tests the Layout Builder UI.
Namespace
Drupal\Tests\layout_builder\FunctionalCode
public function testBreadcrumb() {
$page = $this->getSession()
->getPage();
$this->drupalPlaceBlock('system_breadcrumb_block');
$this->drupalLogin($this->drupalCreateUser([
'configure any layout',
'administer node display',
'administer content types',
'access administration pages',
]));
// From the manage display page, go to manage the layout.
$this->drupalGet('admin/structure/types/manage/bundle_with_section_field/display/default');
$this->submitForm([
'layout[enabled]' => TRUE,
], 'Save');
$this->submitForm([
'layout[allow_custom]' => TRUE,
], 'Save');
$page->clickLink('Manage layout');
$breadcrumb_titles = [];
foreach ($page->findAll('css', '.breadcrumb a') as $link) {
$breadcrumb_titles[$link->getText()] = $link->getAttribute('href');
}
$base_path = base_path();
$expected = [
'Home' => $base_path,
'Administration' => $base_path . 'admin',
'Structure' => $base_path . 'admin/structure',
'Content types' => $base_path . 'admin/structure/types',
'Bundle with section field' => $base_path . 'admin/structure/types/manage/bundle_with_section_field',
'Manage display' => $base_path . 'admin/structure/types/manage/bundle_with_section_field/display/default',
'External link' => 'http://www.example.com',
];
$this->assertSame($expected, $breadcrumb_titles);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.