public function MenuItemExtrasMenuConfigTest::testMultilevelItems in Menu Item Extras 8
Test multilevel menu item render.
File
- tests/
src/ Functional/ MenuItemExtrasMenuConfigTest.php, line 90
Class
- MenuItemExtrasMenuConfigTest
- Rendering menu items tests.
Namespace
Drupal\Tests\menu_item_extras\FunctionalCode
public function testMultilevelItems() {
$user = $this
->createUser([], [], TRUE);
$this
->drupalLogin($user);
$assert = $this
->assertSession();
$edit_menu_url = Url::fromRoute('entity.menu.edit_form', [
'menu' => $this->menu
->id(),
]);
$edit_link_url = Url::fromRoute('entity.menu_link_content.edit_form', [
'menu_link_content' => $this->links[1]['entity']
->id(),
]);
$this
->drupalGet($edit_menu_url);
$assert
->checkboxNotChecked('add_extras');
$this
->drupalPostForm($edit_menu_url, [
'add_extras' => '1',
], 'Save');
$assert
->checkboxChecked('add_extras');
$this
->drupalGet($edit_link_url);
$assert
->fieldExists('Body');
$this
->drupalPostForm($edit_menu_url, [
'add_extras' => '0',
], 'Save');
$assert
->checkboxNotChecked('add_extras');
$this
->drupalGet($edit_link_url);
$assert
->fieldNotExists('Body');
}