MenuLinkReorderTest.php in Drupal 9
File
core/modules/menu_ui/tests/src/Functional/MenuLinkReorderTest.php
View source
<?php
namespace Drupal\Tests\menu_ui\Functional;
use Drupal\Tests\BrowserTestBase;
class MenuLinkReorderTest extends BrowserTestBase {
protected $administrator;
protected static $modules = [
'menu_ui',
'test_page_test',
'node',
'block',
];
protected $defaultTheme = 'stark';
public function testDefaultMenuLinkReorder() {
$this
->drupalPlaceBlock('system_menu_block:main');
$this
->drupalGet('test-page');
$this
->assertSession()
->linkExists('Home');
$this->administrator = $this
->drupalCreateUser([
'administer site configuration',
'access administration pages',
'administer menu',
]);
$this
->drupalLogin($this->administrator);
$edit = [
'links[menu_plugin_id:test_page_test.front_page][weight]' => -10,
];
$this
->drupalGet('admin/structure/menu/manage/main');
$this
->submitForm($edit, 'Save');
$this
->drupalGet('test-page');
$this
->assertSession()
->linkExists('Home');
$this
->drupalGet('admin/config/development/performance');
$this
->submitForm([], 'Clear all caches');
$this
->drupalGet('test-page');
$this
->assertSession()
->linkExists('Home');
}
}