function RouteProcessorManagerTest::testRouteProcessorManager

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php \Drupal\Tests\Core\RouteProcessor\RouteProcessorManagerTest::testRouteProcessorManager()
  2. 10 core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php \Drupal\Tests\Core\RouteProcessor\RouteProcessorManagerTest::testRouteProcessorManager()
  3. 11.x core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php \Drupal\Tests\Core\RouteProcessor\RouteProcessorManagerTest::testRouteProcessorManager()

Tests the Route process manager functionality.

File

core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php, line 34

Class

RouteProcessorManagerTest
@coversDefaultClass \Drupal\Core\RouteProcessor\RouteProcessorManager @group RouteProcessor

Namespace

Drupal\Tests\Core\RouteProcessor

Code

public function testRouteProcessorManager() {
    $route = new Route('');
    $parameters = [
        'test' => 'test',
    ];
    $route_name = 'test_name';
    $processors = [
        10 => $this->getMockProcessor($route_name, $route, $parameters),
        5 => $this->getMockProcessor($route_name, $route, $parameters),
        0 => $this->getMockProcessor($route_name, $route, $parameters),
    ];
    // Add the processors in reverse order.
    foreach ($processors as $priority => $processor) {
        $this->processorManager
            ->addOutbound($processor, $priority);
    }
    $bubbleable_metadata = new BubbleableMetadata();
    $this->processorManager
        ->processOutbound($route_name, $route, $parameters, $bubbleable_metadata);
    // Default cacheability is: permanently cacheable, no cache tags/contexts.
    $this->assertEquals((new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT), $bubbleable_metadata);
}

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