Problem/Motivation
Today, the default theme when writing tests is classy, which is likely deprecated in the future #3050378: [meta] Replace Classy with a starterkit theme. For this, and various other reasons Classy is decoupled from the testing infrastructure: #2352949: Deprecate using Classy as the default theme for the 'testing' profile. Until now, we assume there isn't a default value in Drupal 9 and it is required for all test cases not specifying installation profile to specify which theme they use in their tests. However, “no default” is just one of the possible choices.
The 3 possible choices:
| Theme | Pros | Cons | When best fit? |
|---|---|---|---|
| None |
|
Boilerplate: every test must specify it | N/A |
stark |
No boilerplate | Higher probability of breaking between minor releases |
|
stable9 |
No boilerplate | Higher probability of breaking between major releases |
|
(In Drupal 9, the default would be stable9, in Drupal 10, it would be stable10, and so on.)
Default: opt-in vs opt-out?
There might be a way to be both explicit and provide a default value. We could set a default value that is set only if the test case has explicitly opted into the default. One option would be provide TESTING_DEFAULT_THEME constant which would allow test cases to use the current default value. This would remove the need to manually update testing theme on major releases.
- Drupal 9
-
const TESTING_DEFAULT_THEME = ‘stable9’; const CORE_TESTING_DEFAULT_THEME = ‘stark’; - Drupal 10
-
const TESTING_DEFAULT_THEME = ‘stable10’; const CORE_TESTING_DEFAULT_THEME = ‘stark’;
Proposed resolution
TBD
Remaining tasks
- Decide what is the default theme for testing in Drupal 9 if any
- Decide if the default theme is set explicitly or implicitly
User interface changes
None
API changes
TBD
Comments
Comment #2
wim leersComment #3
wim leers#2352949: Deprecate using Classy as the default theme for the 'testing' profile landed. Let's continue here!
Comment #4
xjmComment #5
xjmOf these, I think Stark is the best option.
stableN, then we have a potentially huge pile of technical debt every major release.So my suggestion is to use
stark, see how many tests already pass with that, and then stickclassyon whatever still fails, with a@todoto #3083275: [meta] Update tests that rely on Classy to not rely on it anymore.Comment #6
xjmLooks like #3082655: Specify the $defaultTheme property in all functional tests is already taking an approach consistent with that proposal.
Comment #7
lauriiiI agree that using
starkfor testing makes sense for core in all test cases except ones specifically testing other themes, therefore it should be the default theme for all core tests. However, this issue was opened because we weren't quite not convinced that usingstarkfor contrib tests would make sense. Usingstarkas the default testing theme for contrib would add burden to minor release upgrades, as well as potentially disincentivize writing tests.+1, we definitely want to avoid this in core.
Is this statement against requiring test authors to explicitly opt-in for using a default theme?
Comment #8
wim leers#5: "@todo to #3083275" looks like it's not the issue you wanted to link? :)
Comment #9
xjm@Wim Leers, no, it definitely is. Edit: What my comment says is what I mean. Yours is a different number. :)
Every time we set the profile to
classyto get the test to pass, we're adding technical debt that needs to be cleaned up before we remove Classy. So each time we do that, there should be a @todo to the meta for removing said coupling.It would be nice for both core and contrib to have a non-boilerplate option. Contrib will after all just copy core and end up setting
starkeven if we make the default valuestable9to be "nice" to them. Also, we're still adding major technical debt for contrib if we do this, because we're still implicitly encouraging them to couple their tests to markup and then have to update to the new stable all at once each major.We should summon actual contrib maintainers for input also. I suggest Berdir as I know he's run into the same problem of tests starting to fail when we change button labels or such.
Comment #11
xjmWhat are the next steps here? Do we need to implement this? Is it D9-only?
Comment #12
dwwI think we've decided. Stark seems like the best (default) choice, and we should use that whenever feasible. I think #3083275: [meta] Update tests that rely on Classy to not rely on it anymore is where all the work needs to happen now. I vote to mark this fixed and move on to #3083275...
Comment #13
jaykandariSubscribe
Comment #19
quietone commentedI agree with #12 that this is fixed and the change record was published in 2019. The implementation was moved to other issue.
I've updated credit and moving straight to Fixed.