Skip to content

Conversation

@tonypaulbarker
Copy link
Contributor

Closes #330

Success criteria:

Tests like those in localgov_blogs should be able to install this in both Drupal 10 and Drupal 11 to get their config dependencies.

@tonypaulbarker
Copy link
Contributor Author

This MR is a dead end.

@finnlewis
Copy link
Member

Hey @tonypaulbarker , why is it a dead end, what did it reveal?

@tonypaulbarker
Copy link
Contributor Author

@finnlewis the same timing problem occurs here as with the original optional directory in the localgov_media module so we see the same errors.

  1. Dirty workaround - check for Drupal version and conditionally install the config if greater than or equal to 11.2

  2. Debug the timing in lots of detail and try rebuilding containers in the tests another way

Try this sort of thing to work around the container rebuild problem:
function localgov_media_install() { if (version_compare(\Drupal::VERSION, '11.2', '>=')) { if (drupal_valid_test_ua() { \Drupal::service('kernel')->invalidateContainer(); } } }

Try to rebuild at certain points in the test
$this->container = $this->kernel->rebuildContainer();

Try controlling the timing of installing things in the test
\Drupal::service('module_installer')->install(['localgov_media']);

  1. Fix up the media module to really install things another way than hook and optional directory.

@andybroomfield
Copy link
Contributor

andybroomfield commented Nov 5, 2025

Something like Configuration Rewrite be useful here?

If I remember correctly the underlying issue is we install media config that already exists in standard profile. Could we replace it if it exists (or skip)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test media config fails on Drupal 10

4 participants