Problem/Motivation

Drupal is now using the classy theme to provide default markup & classes - A lot of the functional tests are using markup & css classes, so we need to change from stark to classy to keep testbot happy.

Proposed resolution

Change the testing profile to use Classy theme instead of Stark.

Remaining tasks

User interface changes

N/A

API changes

The Testing profile uses the Classy theme.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task
Issue priority Major because modification of core templates cannot proceed without this change, which blocks "dream markup" and "consensus banana" changes.
Unfrozen changes Unfrozen because it only changes automated tests.
Prioritized changes This issue is a prioritized change (theme improvements) as per https://www.drupal.org/core/beta-changes and it's benefits outweigh any disruption.
CommentFileSizeAuthor
#81 interdiff.txt351 byteslmakarov
#81 use_the_classy_theme_in-2350823-80.patch27.58 KBlmakarov
#75 interdiff.txt326 byteslauriii
#75 use_the_classy_theme_in-2350823-74.patch27.49 KBlauriii
#72 interdiff.txt288 bytesdavidhernandez
#72 use_the_classy_theme_in-2350823-72.patch27.41 KBdavidhernandez
#64 temporarily_use_the-2350823-64.patch27.26 KBlauriii
#61 interdiff.txt2.59 KBlauriii
#61 temporarily_use_the-2350823-61.patch27.14 KBlauriii
#54 temporarily_use_the-2350823-54.patch24.32 KBlauriii
#51 change-testing-theme-2350823-51.patch28.44 KBjhedstrom
#51 interdiff.txt20.76 KBjhedstrom
#46 change-testing-theme-2350823-46.patch25.63 KBjhedstrom
#38 change-testing-theme-2350823-38.patch28.36 KBjhedstrom
#38 interdiff.txt655 bytesjhedstrom
#35 change-testing-theme-2350823-35.patch28.36 KBjhedstrom
#35 interdiff.txt1.96 KBjhedstrom
#34 change-testing-theme-2350823-34.patch28.35 KBjhedstrom
#34 interdiff.txt19.53 KBjhedstrom
#31 temporarily_use_the-2350823-31.patch27.12 KBlauriii
#31 interdiff-2350823-29-31.txt808 byteslauriii
#29 temporarily_use_the-2350823-29.patch26 KBlauriii
#27 temporarily_use_the-2350823-27.patch26.25 KBlauriii
#27 interdiff-2350823-25-27.txt515 byteslauriii
#25 interdiff-2350823-21-25.txt8.96 KBlauriii
#25 temporarily_use_the-2350823-25.patch25.47 KBlauriii
#21 temporarily_use_the-2350823-21.patch15.34 KBcilefen
#21 interdiff-19-21.txt9.67 KBcilefen
#19 temporarily_use_the-2350823-19.patch4.67 KBcilefen
#19 interdiff-17-19.txt2.98 KBcilefen
#17 2350823-17.patch1.39 KBtim bozeman
#17 interdiff.txt646 bytestim bozeman
#15 2350823-15.patch775 bytesstar-szr
#12 classy-testing-2350823-12.patch730 bytestim bozeman
#12 interdiff-1-12.txt778 bytestim bozeman
#9 classy-testing-2350823-7.patch287 bytestim bozeman
#6 interdiff.txt738 bytestim bozeman
#6 classy-testing-2350823-6.patch690 bytestim bozeman
#1 classy-testing.patch422 bytesxjm

Comments

xjm’s picture

Category: Bug report » Task
Priority: Normal » Major
Status: Active » Needs review
Parent issue: » #2348543: [meta] Consensus Banana Phase 2, transition templates to the starterkit theme
Related issues: -#2348543: [meta] Consensus Banana Phase 2, transition templates to the starterkit theme
StatusFileSize
new422 bytes

Here is what this would look like I think?

We'd need a followup to remove this dependency (which we reference in the patch). ;) We might also need followups to look at these tests that specifically mention Spark to ensure they're not losing coverage:

core/modules/block/src/Tests/BlockConfigSchemaTest.php
core/modules/block/src/Tests/BlockRenderOrderTest.php
core/modules/block/src/Tests/BlockStorageUnitTest.php
core/modules/block/src/Tests/BlockTest.php
core/modules/block/src/Tests/BlockUiTest.php
core/modules/block/src/Tests/BlockViewBuilderTest.php
core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php
core/modules/block/src/Tests/Views/DisplayBlockTest.php
core/modules/block_content/src/Tests/BlockContentTypeTest.php
core/modules/comment/src/Tests/CommentLinksTest.php
core/modules/config/src/Tests/ConfigImportUITest.php
core/modules/language/src/Tests/LanguageBlockSettingsVisibilityTest.php
core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php
core/modules/search/src/Tests/SearchBlockTest.php
core/modules/system/src/Tests/Block/SystemMenuBlockTest.php
core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php
core/modules/system/src/Tests/Bootstrap/PageCacheTest.php
core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php
core/modules/system/src/Tests/Extension/ThemeHandlerTest.php
core/modules/system/src/Tests/Installer/InstallerTranslationTest.php
core/modules/system/src/Tests/Menu/MenuRouterTest.php
core/modules/system/src/Tests/System/ThemeTest.php
core/modules/system/src/Tests/Theme/ThemeEarlyInitializationTest.php
core/modules/system/src/Tests/Theme/ThemeSettingsTest.php
core/modules/tour/src/Tests/TourCacheTagsTest.php
core/modules/views/src/Tests/Handler/FilterStringTest.php
core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php
xjm’s picture

Title: Test change from stark to classy » Temporarily use the Classy theme in the Testing profile
Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 1: classy-testing.patch, failed testing.

tstoeckler’s picture

That just enables the theme, it does not set it as default, unless I am missing something. We also need to ship a system.theme.yml config file which sets classy as default (With the same @todo).

alexpott’s picture

+1 for the approach of enabling and using classy in the testing profile - will definitely be the sane way to sort this out whilst keeping existing test coverage.

tim bozeman’s picture

Issue summary: View changes
StatusFileSize
new690 bytes
new738 bytes
tim bozeman’s picture

Status: Needs work » Needs review
tim bozeman’s picture

* with new line

tim bozeman’s picture

StatusFileSize
new287 bytes

omg and patch

The last submitted patch, 6: classy-testing-2350823-6.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 9: classy-testing-2350823-7.patch, failed testing.

tim bozeman’s picture

Status: Needs work » Needs review
StatusFileSize
new778 bytes
new730 bytes

wow. spam much?

sorry, not very classy :(

Status: Needs review » Needs work

The last submitted patch, 12: classy-testing-2350823-12.patch, failed testing.

star-szr’s picture

Assigned: Unassigned » star-szr

Going to see if I can get less fails on this one. Thanks for bumping this along @Tim Bozeman :)

star-szr’s picture

Assigned: star-szr » Unassigned
Status: Needs work » Needs review
StatusFileSize
new775 bytes

This probably won't be green (and either way it looks like we might want to update the following line in KernelTestBase), but this should get us further:

\Drupal::config('system.theme')->set('default', 'stark');

The only change here is moving system.theme.yml into config/install so no interdiff.

Status: Needs review » Needs work

The last submitted patch, 15: 2350823-15.patch, failed testing.

tim bozeman’s picture

Status: Needs work » Needs review
StatusFileSize
new646 bytes
new1.39 KB

I changed KernelTestBase:206 from

 \Drupal::config('system.theme')->set('default', 'stark');

to

\Drupal::config('system.theme')->set('default', 'classy');

Status: Needs review » Needs work

The last submitted patch, 17: 2350823-17.patch, failed testing.

cilefen’s picture

Status: Needs work » Needs review
StatusFileSize
new2.98 KB
new4.67 KB

Many tests reference stark. I started here with FeedCacheTagsTest and worked up the class tree for that test.

Status: Needs review » Needs work

The last submitted patch, 19: temporarily_use_the-2350823-19.patch, failed testing.

cilefen’s picture

Status: Needs work » Needs review
StatusFileSize
new9.67 KB
new15.34 KB

This is just a continuation. I'll stop here because this is ultimately just a find-and-replace of stark and classy.

Status: Needs review » Needs work

The last submitted patch, 21: temporarily_use_the-2350823-21.patch, failed testing.

tstoeckler’s picture

Wow, that's quite a lot of changes. Since this is only meant as a temporary measure, we're going to end up having to revert all those changes later on. So I think we should either

1. Change all those instances to use the default theme dynamically instead of hardcoding it

2. Reconsider whether this issue is worth it.

davidhernandez’s picture

The worth it part is that we can't proceed with moving templates to Classy without this fix. Because many of the web tests check for classes in the outputted markup, moving the classes from core to Classy breaks those tests. Either we change all the tests, or try to get everything to use Classy. I'm also open to any other clever solutions, if anyone can think of any.

The temporariness is debatable. I have a feeling it won't be temporary, and 8 will release with it. (one person's opinion) But I don't think we've come up with any reasons why it's bad if it gets released this way.

lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new25.47 KB
new8.96 KB

Yeah it might be good to have this dynamically but Im not sure if its possible in reasonable time.

Status: Needs review » Needs work

The last submitted patch, 25: temporarily_use_the-2350823-25.patch, failed testing.

lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new515 bytes
new26.25 KB

Status: Needs review » Needs work

The last submitted patch, 27: temporarily_use_the-2350823-27.patch, failed testing.

lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new26 KB

Status: Needs review » Needs work

The last submitted patch, 29: temporarily_use_the-2350823-29.patch, failed testing.

lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new808 bytes
new27.12 KB

Yeah, lets see if this works o/

tim bozeman’s picture

\o

jhedstrom’s picture

Assigned: Unassigned » jhedstrom
Status: Needs review » Needs work

I'll take a stab at removing the hard-codedness mentioned in #23.

jhedstrom’s picture

Status: Needs work » Needs review
StatusFileSize
new19.53 KB
new28.35 KB

This replaces hard-coded instances with a class variable.

jhedstrom’s picture

StatusFileSize
new1.96 KB
new28.36 KB

Oops, missed a few.

The last submitted patch, 34: change-testing-theme-2350823-34.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 35: change-testing-theme-2350823-35.patch, failed testing.

jhedstrom’s picture

Status: Needs work » Needs review
StatusFileSize
new655 bytes
new28.36 KB

This should fix the notices.

lauriii’s picture

I think we need to first discuss whether we want to add this 'dynamic' thing there. I'm not sure if there's gonna even be way back anytime soon. Most of the tests need the classes that are not there anymore and what I looked there's a lot of them where its going to be hard to find any good alternative solutions without decreased test coverage.

It's still not 100% and it creates more complexity. Also all the test writers should be aware of it to use it later. I think its more clear for people if we are only using hard coded value of the theme. It's already confusing enough to use Classy there I think.

lauriii’s picture

Assigned: jhedstrom » Unassigned

I'm going to unassign you jhedstrom. Thanks for your work! You can keep working on the issue while we've discussed this.

jhedstrom’s picture

I think we need to first discuss whether we want to add this 'dynamic' thing there. I'm not sure if there's gonna even be way back anytime soon.

I don't think it's meant to be dynamic--it simply makes future changes simpler than this one. It will also make it easier to find (and fix) the tests that fail based on the assumption of a given theme (which led to this issue in the first place).

davidhernandez’s picture

I'm not strongly in one camp or the other. I'm strongly planted in the "whatever works" camp. That said, two thoughts. One, is it really going to be that hard to change back, especially if we know what we changed? Two, does using the variable make it harder to work with if this stays in permanently?

The big picture here is that we still don't have a solid idea of whether we'll be able to make all the changes necessary to undo this change, so we should try to limit changes we could regret.

cilefen’s picture

If there are tests that rely on classes existing, etc, then why should this not be a permanent change?

davidhernandez’s picture

There is/was hope that those tests can be changed, as they're using the class check as somewhat of a convenience to verify the existence of the right content. However, there are a lot, and some would require completely rewriting the test.

The negative is that we will be, in part, testing the base theme instead of just whatever core functionality the tests were covering. But I think we crossed that bridge when we started moving the classes from preprocess to the templates. As soon as we did that, we are involving template files in the tests. The question just becomes where does the template file come from?

tim.plunkett’s picture

All of the self:: calls should be static:: in order to allow them to be overridden.

jhedstrom’s picture

StatusFileSize
new25.63 KB

This changes selff::$theme to static::$theme. Sorry, no interdiff as I just replaced directly in the patch file rather than manually replacing.

Status: Needs review » Needs work

The last submitted patch, 46: change-testing-theme-2350823-46.patch, failed testing.

bradwade’s picture

Late in the Drupal 8 development cycle, we have moved core classes out of core and into Classy, therefore Classy should be used for testing. This seems like a clear, good, logical conclusion. It should not be viewed as temporary, but instead as the standard for Drupal 8.

If we want tests to be written differently, so that functionality of modules can be tested without using Classy, we write up the documentation and recommend the best practice and have module maintainers update their tests at the next major Drupal release. But for Drupal 8, use Classy for testing... and move on.

I recommend changing title of the thread to, "Use the Classy theme in the Testing profile".

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 46: change-testing-theme-2350823-46.patch, failed testing.

jhedstrom’s picture

Status: Needs work » Needs review
StatusFileSize
new20.76 KB
new28.44 KB

The patch above lost a key bit of functionality (in changing the default theme). This is an interdiff from the working patch in #38.

davidhernandez’s picture

Issue tags: +Needs change record

This will need a well publicized change record.

lauriii’s picture

Assigned: Unassigned » lauriii
lauriii’s picture

StatusFileSize
new24.32 KB

I don't want to step on anyones toes but we had a discussion in the Twig meeting and I guess everyone at least on some level agreed there that we should implement on this issue the most simple possible solution. What I think we need to full fill that is just using the hard coded theme all over the place. I think @bradwade said that we shouldn't be against anyone or anyone's ideas but just moving this forward as fast as possible because we are blocking tens of issues with this.

I think its a good idea to have dynamic theme on the tests but the problem is that its not in the scope of this issue and because of that it will never get good enough. For this reason I would suggest us to create that in a follow-up. We can use the solution @jhedstrom has given here as a starting point there.

I have also pointed out my other concerns on doing that there #39.

One addition to my previous concerns is that its hard to fallback because of contribs might also rely on using classy as base for tests so we would break those contrib tests also.

So here I have a patch with the latest working solution with hard coded theme.

lauriii’s picture

Assigned: lauriii » Unassigned
jhedstrom’s picture

I think changing from a hard-coded string, to a static string variable is well within the scope of this for all the reasons previously stated. I think the word 'dynamic' was misused above. The change in #51 is no more dynamic than hard coding 'classy'. It simply removes all those hard-coded instances and makes them easier to change in the future (which will be desirable at some point as we move tests away from relying on themes/classes, making future patches simpler).

jhedstrom’s picture

Title: Temporarily use the Classy theme in the Testing profile » Use the Classy theme in the Testing profile

Changing title as suggested by bradwade in #48.

Status: Needs review » Needs work

The last submitted patch, 54: temporarily_use_the-2350823-54.patch, failed testing.

davidhernandez’s picture

+1 for hard-coded for now. Part of the issue raised during the call was added complexity with tests potentially having the check the variable, or not having an understanding of which theme was actually being used and confusing people. The usefulness of being able to more easily change it is mitigated by the fact that we don't think this is changing before release.

We really would like to work out some additional cleverness in how the theme is handled during testing, but this isn't the time to do it. I want to RTBC something now and get this in, as it is blocking too many things.

lauriii’s picture

I don't think it makes moving back that much easier because we still have to check all the instances whether people have used that variable or not. I personally wouldn't expect something like that to exist. I also think that is absurd to base any arguments on moving back because its not happening. I think it's also unnecessary complexity (people don't see immediately which theme their using). Good thing is that if you want to use Stark somewhere you could set this variable to Stark and also change the theme but I don't think it's argument here because its not in the scope of this issue.

Anyways I'm not gonna argue here forever. If anyone else has opinion please express it here, I'm done. I just want to get this issue from blocking those issues.

lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new27.14 KB
new2.59 KB

Here's patch which should be more bot friendly.

joelpittet’s picture

I completely agree with #60;)

+++ b/core/themes/classy/classy.info.yml
@@ -4,3 +4,7 @@ description: 'A base theme with sensible default CSS classes added. Learn how to
diff --git a/core/themes/classy/logo.png b/core/themes/classy/logo.png

diff --git a/core/themes/classy/logo.png b/core/themes/classy/logo.png
new file mode 100644

new file mode 100644
index 0000000..32332cf

index 0000000..32332cf
--- /dev/null

--- /dev/null
+++ b/core/themes/classy/logo.png

+++ b/core/themes/classy/logo.png
+++ b/core/themes/classy/logo.png
@@ -0,0 +1,8 @@

@@ -0,0 +1,8 @@
+�PNG

Did this sneak in by accident?

lauriii’s picture

No, there's tests requiring it

lauriii’s picture

StatusFileSize
new27.26 KB

There should be also empty layout.css file which is required by some tests. (not the file but loading that file)

davidhernandez’s picture

Issue summary: View changes

Adding beta phase evaluation.

davidhernandez’s picture

@lauriii, can you post an interdiff, please?

jhedstrom’s picture

Status: Needs review » Reviewed & tested by the community

#64 is RTBC. It will unblock a tremendous amount of work in the front end, and we can follow up in a new issue, as mentioned above, to address the hard-coded nature of the tests.

tstoeckler’s picture

Just some notes:
- Even though we might not get it done for 8.0.0 it must certainly be the end-goal to have all core tests have as few dependencies as possible and that includes any Classy markup. Reasons:
A) This improves test isolation
B) Improves performance of the test runs
C) Since Classy is a completely optional theme and the tests of modules should be testing module functionality, there should be absolutely no reason that the modules rely on Classy markup and thus the tests shouldn't either. Separation of functionality and appearance, anyone?

- It is highly preferable to use a dynamic solution to avoid future refactorings. Not only will this make going back from Classy to Stark slightly easier, more importantly it will completely eliminate the issues we are facing here if we ever decide to rename Classy or Stark of whatever in the future, or if we have a new default theme in the future. This is just a matter of decoupling systems. A test should not have any knowledge about what we decided to call our default theme, whether its Classy, Stark or whatever. I shouldn't have to know in order to write a test, even one that interacts with themes.

So from my point of view #51 is RTBC not #64 but I'll let you guys procede here. Just wanted to point the above out, because I don't think these points were considered above.

lauriii’s picture

@tstoeckler: I understand your point of you but those things are not in the target of this issue. This issue is created to unblock all the Banana Phase 2 issues by using classy as a default theme on the tests. We had discussion about this issue on Twig meeting and we all agreed that we have to get this issue away from blocking all the Banana Phase 2 issues. Because of that we wanted to find a solution with least resistance. We can do all the improvements on a follow-up and have the discussion about that properly there.

tstoeckler’s picture

Sure. I find that process a bit strange because it seems the work was already done here (#51) but I don't want to hold up the awesome Banana effort in which you guys have put so much effort in any way. That's why I left it at RTBC. :-)

imiksu’s picture

I agree that we keep the original scope and create an issue about making the testing theme changeable as there might be couple of thing to consider like how to write tests when your XPaths might be different depending on the theme used...

davidhernandez’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new27.41 KB
new288 bytes

I'm just adding a comment to the empty layout file that it is used for testing.

yesct’s picture

Status: Needs review » Needs work

I think it would be helpful to @see the test that needs this file.

https://www.drupal.org/node/1354#see

also the issue summary needs updated.

if the tasks in the remaining tasks list are done, update the line in the summary pointing out which comment number did it.
if the tasks are not done.. do them. :)

looks like there is a change record draft, but the needs change record tag is still on the issue, does the change record need review?

victoru’s picture

Issue tags: -Needs change record

Removing the change record tag

lauriii’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new27.49 KB
new326 bytes

Change record needs review.

MKorostoff’s picture

Issue summary: View changes
MKorostoff’s picture

Issue summary: View changes
MKorostoff’s picture

Issue summary: View changes
lmakarov’s picture

Assigned: Unassigned » lmakarov
Status: Needs review » Needs work

@lauriii missed the second test. Adding this now.

MKorostoff’s picture

Issue summary: View changes
lmakarov’s picture

Assigned: lmakarov » Unassigned
Status: Needs work » Needs review
StatusFileSize
new27.58 KB
new351 bytes

Adding the second test.

seantwalsh’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, moving this back to RTBC. Just a small change since #67.

MKorostoff’s picture

Issue summary: View changes
MKorostoff’s picture

Added followup for adding test coverage to Classy #2380401: Add test coverage to Classy theme

MKorostoff’s picture

Issue summary: View changes
MKorostoff’s picture

Issue summary: View changes

Change record looks good to me. Updating issue summary and marking "Review the change record" as complete.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed bbb4de9 and pushed to 8.0.x. Thanks!

Thanks for adding the beta evaluation for to the issue summary.

  • alexpott committed bbb4de9 on 8.0.x
    Issue #2350823 by lauriii, jhedstrom, Tim Bozeman, cilefen,...
davidhernandez’s picture

We caused a problem with Bartik that obviously no one noticed. If we don't fix it quickly, we need to roll this back. I added another issue. #2380605: Bartik layout broken

jibran’s picture

Please @alexpott don't commit front-end patches without screenshots.

davidhernandez’s picture

Should be all better now, whew.

jhedstrom’s picture

jibran’s picture

I apologize for my comment in #90. I was told my comment was rude so I am sorry about it.
Thank you everyone for fixing this and follow up issue.

tim.plunkett’s picture

I updated the CR to address the fact that this breaks any test that assumed stark was installed: https://www.drupal.org/node/2380181/revisions/view/7863059/7890643

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.