You are here

protected function MenuUiTest::doTestMenuBlock in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::doTestMenuBlock()

Tests menu block settings.

1 call to MenuUiTest::doTestMenuBlock()
MenuUiTest::testMenu in core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
Tests menu functionality using the admin and user interfaces.

File

core/modules/menu_ui/tests/src/Functional/MenuUiTest.php, line 1022

Class

MenuUiTest
Add a custom menu, add menu links to the custom menu and Tools menu, check their data, and delete them using the UI.

Namespace

Drupal\Tests\menu_ui\Functional

Code

protected function doTestMenuBlock() {
  $menu_id = $this->menu
    ->id();
  $block_id = $this->blockPlacements[$menu_id];
  $this
    ->drupalGet('admin/structure/block/manage/' . $block_id);
  $this
    ->submitForm([
    'settings[depth]' => 3,
    'settings[level]' => 2,
  ], 'Save block');
  $block = Block::load($block_id);
  $settings = $block
    ->getPlugin()
    ->getConfiguration();
  $this
    ->assertEquals(3, $settings['depth']);
  $this
    ->assertEquals(2, $settings['level']);

  // Reset settings.
  $block
    ->getPlugin()
    ->setConfigurationValue('depth', 0);
  $block
    ->getPlugin()
    ->setConfigurationValue('level', 1);
  $block
    ->save();
}