You are here

protected function MenuTest::doTestMenuBlock in Zircon Profile 8.0

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

Tests menu block settings.

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

File

core/modules/menu_ui/src/Tests/MenuTest.php, line 948
Contains \Drupal\menu_ui\Tests\MenuTest.

Class

MenuTest
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\menu_ui\Tests

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();
}