function SearchPageValidationTest::testBaseRouteIsValid

Same name in other branches
  1. 10 core/modules/search/tests/src/Kernel/SearchPageValidationTest.php \Drupal\Tests\search\Kernel\SearchPageValidationTest::testBaseRouteIsValid()

Test that the base route stored in definition is correct.

File

core/modules/search/tests/src/Kernel/SearchPageValidationTest.php, line 52

Class

SearchPageValidationTest
Tests validation of search_page entities.

Namespace

Drupal\Tests\search\Kernel

Code

public function testBaseRouteIsValid() : void {
    $search_page_repository = new SearchPageRepository(\Drupal::configFactory(), \Drupal::entityTypeManager());
    $search_local_task = new SearchLocalTask($search_page_repository);
    $definitions = $search_local_task->getDerivativeDefinitions([]);
    $route_provider = \Drupal::service('router.route_provider');
    $base_route = $route_provider->getRouteByName($definitions['test']['base_route']);
    $this->assertSame($base_route, $route_provider->getRouteByName('search.view'));
}

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