function NavigationUpdateTest::testShortcutNavigationBlockUpdate

Same name and namespace in other branches
  1. main core/modules/navigation/tests/src/Functional/Update/NavigationUpdateTest.php \Drupal\Tests\navigation\Functional\Update\NavigationUpdateTest::testShortcutNavigationBlockUpdate()

Tests the removal of the navigation_shortcuts block.

File

core/modules/navigation/tests/src/Functional/Update/NavigationUpdateTest.php, line 38

Class

NavigationUpdateTest
Tests moving search from node to search_node.

Namespace

Drupal\Tests\navigation\Functional\Update

Code

public function testShortcutNavigationBlockUpdate() : void {
  $this->assertTrue(\Drupal::moduleHandler()->moduleExists('navigation'));
  $this->assertFalse(\Drupal::moduleHandler()->moduleExists('shortcut'));
  $config = \Drupal::config('navigation.block_layout');
  $sections = $config->get('sections');
  // Confirm the navigation shortcut block exists.
  // UUID of the navigation_shortcuts block.
  $uuid = '2622e40b-8786-4b8c-8883-19e49da53023';
  $this->assertArrayHasKey($uuid, $sections[0]['components']);
  $this->runUpdates();
  // Confirm the navigation shortcut block has been removed.
  $config = \Drupal::config('navigation.block_layout');
  $sections = $config->get('sections');
  $this->assertArrayNotHasKey($uuid, $sections[0]['components']);
}

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