diff --git a/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php b/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php index 6018122..56ad6fc 100644 --- a/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php +++ b/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php @@ -7,8 +7,9 @@ namespace Drupal\system\Tests\HttpKernel; -use Drupal\simpletest\KernelTestBase; +use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Url; +use Drupal\simpletest\KernelTestBase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\HttpKernelInterface; @@ -49,4 +50,17 @@ public function testRequest() { $this->assertEqual($request->attributes->get('_previous_optional_argument'), 'test_argument'); } + /** + * Tests that late middlewares are marked as lazy. + */ + public function testLateMiddlewareShouldBeLazy() { + foreach ($this->container->findTaggedServiceIds('http_middleware') as $id => $attributes) { + $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0; + $definition = $this->container->getDefinition($id); + if ($priority < 0) { + $this->assertTrue($definition->isLazy(), SafeMarkup::format('The lazy flag is set on low priority middleware "@id"', array('@id' => $id))); + } + } + } + }