Problem/Motivation
Seen this quite a few times in CI recently
PHPUnit 11.5.42 by Sebastian Bergmann and contributors.
Runtime: PHP 8.4.14
Configuration: /builds/issue/drupal-3555557/core/phpunit.xml.dist
.....F..S. 10 / 10 (100%)
Theme (Drupal\Tests\system\Functional\System\Theme)
✔ Theme settings
✔ Theme settings logo
✔ Theme settings color hex code
✔ Theme settings render cache clear
✔ Administration theme
✘ Switch default theme
┐
├ Failed asserting that two strings are equal.
┊ ---·Expected
┊ +++·Actual
┊ @@ @@
┊ -'olivero'
┊ +'stark'
│
│ /builds/issue/drupal-3555557/core/modules/system/tests/src/Functional/System/ThemeTest.php:447
┴
✔ Invalid theme
✔ Uninstalling themes
✔ Theme settings no logo no favicon
FAILURES!
Tests: 10, Assertions: 238, Failures: 1, Skipped: 1.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3555562
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3555562-theme-test-fix
changes, plain diff MR !13642
- 3555562-theme-test-repeat
changes, plain diff MR !13640
Comments
Comment #5
mstrelan commentedThought we could fix this with WaitTerminateTestTrait but doesn't seem to be the case.
3555562-theme-test-repeat:
Run 1: 3/100 fails
https://git.drupalcode.org/issue/drupal-3555562/-/jobs/7128506
Run 2: 21/100 fails
https://git.drupalcode.org/issue/drupal-3555562/-/jobs/7128619
3555562-theme-test-fix:
Run 1: 12/100 fails
https://git.drupalcode.org/issue/drupal-3555562/-/jobs/7128649
Comment #6
mstrelan commentedSleeping for 1 or 5 seconds doesn't seem to help either:
https://git.drupalcode.org/issue/drupal-3555562/-/jobs/7128867
Comment #7
demeritcowboy commentedThis might be different but maybe https://www.drupal.org/project/drupal/issues/3555844#comment-16331611 is helpful. There was a core commit in 11.x-dev last week where now after installing a theme backend and frontend are misaligned in these tests unless you also repoint "$this" at the new container.
Comment #8
mstrelan commentedThanks @demeritcowboy, resetting the container worked. See https://git.drupalcode.org/issue/drupal-3555562/-/jobs/7139554 where it passed 100 times.
Setting to Needs review for MR !13642, but I wonder if there is a global fix that we could apply. Possibly
\Drupal\Tests\BrowserTestBase::configshould callDrupal::configdirectly.Comment #10
alexpottThis is happening because now a theme install rebuilds the container... interesting that it is random though.
Let's do this fix - ideally $this->container would not exist in functional tests... and we'd always use \Drupal:: for any helper functions.
Comment #11
alexpottDiscussed with @catch and we agreed to move the fix upstream to \Drupal\Tests\BrowserTestBase::config() - note that #2066993: Use magic methods to sync container property to \Drupal::getContainer in functional tests would also fix this... but there's no harm in moving away from $this->container here.
Comment #14
catchCommitted/pushed to 11.x and cherry-picked to 11.3.x, thanks!