diff -u b/core/modules/system/tests/modules/theme_test/theme_test.routing.yml b/core/modules/system/tests/modules/theme_test/theme_test.routing.yml --- b/core/modules/system/tests/modules/theme_test/theme_test.routing.yml +++ b/core/modules/system/tests/modules/theme_test/theme_test.routing.yml @@ -30,0 +31,10 @@ + requirements: + _access: 'TRUE' + +theme_test.priority: + path: '/theme-test/priority' + options: + _custom_theme: 'test_theme' + defaults: + _content: '\Drupal\theme_test\ThemeTestController::testSuggestion' + _title: 'Suggestion' diff -u b/core/modules/system/tests/modules/theme_test/theme_test.services.yml b/core/modules/system/tests/modules/theme_test/theme_test.services.yml --- b/core/modules/system/tests/modules/theme_test/theme_test.services.yml +++ b/core/modules/system/tests/modules/theme_test/theme_test.services.yml @@ -10,0 +11,5 @@ + + theme.negotiator.high_priority: + class: Drupal\theme_test\Theme\HighPriorityThemeNegotiator + tags: + - { name: theme_negotiator, priority: 1000 } only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php @@ -119,6 +119,17 @@ function testPreprocessForSuggestions() { } /** + * Tests the priority of some theme negotiators. + */ + public function testNegotiatorPriorities() { + $this->drupalGet('theme-test/priority'); + + // Ensure that the custom theme negotiator was not able to set the theme. + + $this->assertNoText('Theme hook implementor=test_theme_theme_test__suggestion(). Foo=template_preprocess_theme_test', 'Theme hook suggestion ran with data available from a preprocess function for the base hook.'); + } + + /** * Ensure page-front template suggestion is added when on front page. */ function testFrontPageThemeSuggestion() {