Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295180

Theme must not be primed in core.extension and KernelTestBase

$
0
0

Follow-up to #2228093: Modernize theme initialization

Problem

#2228093: Modernize theme initialization introduced the following two changes, which are highly problematic, since each of them is priming theme configuration ahead of time, which doesn't actually exist yet, and unfortunately worse, they conflict with actual expectations of the installation profile as well as tests:

+++ b/core/config/install/core.extension.yml
@@ -1,4 +1,5 @@
-theme: {}
+theme:
+  stark: 0
+++ b/core/modules/simpletest/src/KernelTestBase.php
@@ -176,7 +176,7 @@ protected function setUp() {
-    \Drupal::service('config.storage')->write('core.extension', array('module' => array(), 'theme' => array()));
+    \Drupal::service('config.storage')->write('core.extension', array('module' => array(), 'theme' => array('seven' => 1, 'stark' => 1)));

These two changes present a critical problem, since priming the configuration ahead of time will cause all new code to be based on the expectation that the configuration "magically" exists already - even though it should not and must not exist, because no code asked for it.

The affected extensions are already marked as installed and will be loaded by default. Their default configuration will not be installed. hook_install() will never be invoked. All tests are running against the changed extension configuration, which does not resemble a clean slate Drupal application.

In other words: Patches that transitioned to RTBC since 2014-08-21 17:00 UTC might not be safe to commit, since fundamental conditions/expectations of the testing framework have changed.

Therefore, we need to fix this ASAP.

Expected behavior

  1. The installer is supposed to use the 'distribution:install:theme' property of the installation profile's .info.yml file, if defined, otherwise fall back to 'seven'.

    cf. #1351352: Distribution installation profiles are no longer able to override the early installer screens

    Nevermind. This still works as before and as expected, because neither _drupal_maintenance_theme() nor install_begin_request() was changed by #2228093: Modernize theme initialization

  2. Kernel tests are supposed to be executed against "no theme at all" by default; i.e., whatever gets rendered is exclusively rendered through the unmodified, original theme functions/templates of modules only.

    The primary purpose of asserting output in kernel tests is to assert the original output of a module, without any kind of theme interaction — unless a theme was explicitly installed manually by a test.

    cf. #1067408: Themes do not have an installation status


Viewing all articles
Browse latest Browse all 295180

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>