function ShortcutLinksTest::testShortcutLinkChangeRoute

Same name and namespace in other branches
  1. 9 core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php \Drupal\Tests\shortcut\Functional\ShortcutLinksTest::testShortcutLinkChangeRoute()
  2. 8.9.x core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php \Drupal\Tests\shortcut\Functional\ShortcutLinksTest::testShortcutLinkChangeRoute()
  3. 11.x 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 299

Class

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

Namespace

Drupal\Tests\shortcut\Functional

Code

public function testShortcutLinkChangeRoute() : void {
  $this->drupalLogin($this->adminUser);
  $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);
}

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