NavigationUpdateTest.php

Same filename and directory in other branches
  1. 11.x core/modules/navigation/tests/src/Functional/Update/NavigationUpdateTest.php

Namespace

Drupal\Tests\navigation\Functional\Update

File

core/modules/navigation/tests/src/Functional/Update/NavigationUpdateTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\navigation\Functional\Update;

use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;

/**
 * Tests moving search from node to search_node.
 */
class NavigationUpdateTest extends UpdatePathTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';
  
  /**
   * {@inheritdoc}
   */
  protected function setDatabaseDumpFiles() : void {
    $this->databaseDumpFiles = [
      __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-11.3.0.bare.standard.php.gz',
      __DIR__ . '/../../../fixtures/navigation_post_update.php',
    ];
  }
  
  /**
   * Tests the removal of the navigation_shortcuts block.
   */
  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']);
  }

}

Classes

Title Deprecated Summary
NavigationUpdateTest Tests moving search from node to search_node.

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