MenuUninstallTest.php

Same filename in other branches
  1. 9 core/modules/menu_ui/tests/src/Functional/MenuUninstallTest.php
  2. 8.9.x core/modules/menu_ui/tests/src/Functional/MenuUninstallTest.php
  3. 11.x core/modules/menu_ui/tests/src/Functional/MenuUninstallTest.php

Namespace

Drupal\Tests\menu_ui\Functional

File

core/modules/menu_ui/tests/src/Functional/MenuUninstallTest.php

View source
<?php

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

use Drupal\Tests\BrowserTestBase;
use Drupal\system\Entity\Menu;

/**
 * Tests that uninstalling menu does not remove custom menus.
 *
 * @group menu_ui
 */
class MenuUninstallTest extends BrowserTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'menu_ui',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * Tests Menu uninstall.
     */
    public function testMenuUninstall() : void {
        \Drupal::service('module_installer')->uninstall([
            'menu_ui',
        ]);
        \Drupal::entityTypeManager()->getStorage('menu')
            ->resetCache([
            'admin',
        ]);
        $this->assertNotEmpty(Menu::load('admin'), 'The \'admin\' menu still exists after uninstalling Menu UI module.');
    }

}

Classes

Title Deprecated Summary
MenuUninstallTest Tests that uninstalling menu does not remove custom menus.

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