You are here

public function PrettyPathsFunctionalTest::testRouteSubscriber in Facets Pretty Paths 8

Test that the module correctly alters the source provider route definition.

File

tests/src/Functional/PrettyPathsFunctionalTest.php, line 89

Class

PrettyPathsFunctionalTest
Main functional test for the Pretty Paths URL processor.

Namespace

Drupal\Tests\facets_pretty_paths\Functional

Code

public function testRouteSubscriber() {

  // Assert the base line that the Views source provider still has the default
  // route definition.
  $route = $this->container
    ->get('router.route_provider')
    ->getRouteByName('view.search.page_1');
  $this
    ->assertInstanceOf(Route::class, $route);
  $this
    ->assertEquals('/facets-search', $route
    ->getPath());

  // Rebuild everything.
  $this
    ->rebuildAll();
  $route = $this->container
    ->get('router.route_provider')
    ->getRouteByName('view.search.page_1');
  $this
    ->assertEquals('/facets-search/{facets_query}/{f0}/{f1}/{f2}/{f3}/{f4}/{f5}/{f6}/{f7}/{f8}/{f9}/{f10}/{f11}/{f12}/{f13}/{f14}/{f15}/{f16}/{f17}/{f18}/{f19}/{f20}/{f21}/{f22}/{f23}/{f24}/{f25}/{f26}/{f27}/{f28}/{f29}/{f30}/{f31}/{f32}/{f33}/{f34}/{f35}/{f36}/{f37}/{f38}', $route
    ->getPath());
  $this
    ->assertEquals('.*', $route
    ->getRequirement('facets_query'));
  $this
    ->assertEquals('', $route
    ->getDefault('facets_query'));
}