function MenuUiTest::doTestMenuBlock

Same name in other branches
  1. 9 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::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 989

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->drupalPostForm(NULL, [
        'settings[depth]' => 3,
        'settings[level]' => 2,
    ], t('Save block'));
    $block = Block::load($block_id);
    $settings = $block->getPlugin()
        ->getConfiguration();
    $this->assertEqual($settings['depth'], 3);
    $this->assertEqual($settings['level'], 2);
    // 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.