You are here

public function ShortcutLinksTest::testShortcutLinkChangeRoute in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php \Drupal\Tests\shortcut\Functional\ShortcutLinksTest::testShortcutLinkChangeRoute()
  2. 9 core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php \Drupal\Tests\shortcut\Functional\ShortcutLinksTest::testShortcutLinkChangeRoute()

Tests that changing the route of a shortcut link works.

File

core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php, line 275

Class

ShortcutLinksTest
Create, view, edit, delete, and change shortcut links.

Namespace

Drupal\Tests\shortcut\Functional

Code

public function testShortcutLinkChangeRoute() {
  $this
    ->drupalLogin($this->rootUser);
  $this
    ->drupalGet('admin/content');
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Disable the view.
  View::load('content')
    ->disable()
    ->save();

  /** @var \Drupal\Core\Routing\RouteBuilderInterface $router_builder */
  $router_builder = \Drupal::service('router.builder');
  $router_builder
    ->rebuildIfNeeded();
  $this
    ->drupalGet('admin/content');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}