function FieldUIRouteTest::testAdminRoute

Same name in other branches
  1. 8.9.x core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php \Drupal\Tests\field_ui\Functional\FieldUIRouteTest::testAdminRoute()

Asserts that admin routes are correctly marked as such.

File

core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php, line 124

Class

FieldUIRouteTest
Tests the functionality of the Field UI route subscriber.

Namespace

Drupal\Tests\field_ui\Functional

Code

public function testAdminRoute() {
    $route = \Drupal::service('router.route_provider')->getRouteByName('entity.entity_test.field_ui_fields');
    $is_admin = \Drupal::service('router.admin_context')->isAdminRoute($route);
    $this->assertTrue($is_admin, 'Admin route correctly marked for "Manage fields" page.');
}

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