function StackedKernelPassTest::createMiddlewareServiceDefinition

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/StackedKernelPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\StackedKernelPassTest::createMiddlewareServiceDefinition()
  2. 8.9.x core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/StackedKernelPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\StackedKernelPassTest::createMiddlewareServiceDefinition()
  3. 10 core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/StackedKernelPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\StackedKernelPassTest::createMiddlewareServiceDefinition()

Creates a middleware definition.

Parameters

bool $tag: Whether or not to set the http_middleware tag.

int $priority: The priority to be used for the tag.

Return value

\Symfony\Component\DependencyInjection\Definition

1 call to StackedKernelPassTest::createMiddlewareServiceDefinition()
StackedKernelPassTest::testProcessWithStackedKernel in core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/StackedKernelPassTest.php
@covers ::process

File

core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/StackedKernelPassTest.php, line 159

Class

StackedKernelPassTest
@coversDefaultClass \Drupal\Core\DependencyInjection\Compiler\StackedKernelPass @group DependencyInjection

Namespace

Drupal\Tests\Core\DependencyInjection\Compiler

Code

protected function createMiddlewareServiceDefinition($tag = TRUE, $priority = 0) {
    $definition = new Definition('Symfony\\Component\\HttpKernel\\HttpKernelInterface', [
        'test',
    ]);
    $definition->setPublic(TRUE);
    if ($tag) {
        $definition->addTag('http_middleware', [
            'priority' => $priority,
        ]);
    }
    return $definition;
}

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