function MenuUiTest::doTestMenuBlock

Same name in other branches
  1. 8.9.x core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::doTestMenuBlock()
  2. 10 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::doTestMenuBlock()
  3. 11.x 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::testMenuAdministration 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 1084

Class

MenuUiTest
Tests the menu 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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.