Closed (outdated)
Project:
Drupal core
Version:
8.0.x-dev
Component:
theme system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
5 Jan 2014 at 09:19 UTC
Updated:
9 Nov 2021 at 10:17 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
clemens.tolboomAttached patch adds get|setDefault() with 'validation'
It is still possible to set to a non-existing theme through the system config so needs more work.
Needs tests.
Let's see what testbot thinks first.
Comment #2
dawehnerLet's put a {@inheritdoc} here.
We certainly should also save the config :)
Please extend the documentation of disable() to include the @throws as well.
It would be kind of cool to know when in which case the Exception is thrown.
nice!
Comment #4
clemens.tolboom@dawehner thanks for the quick review ... I'll work on that.
Patch failed in finding Exception ... should be \Exception I guess
Happened around
Comment #5
clemens.tolboomI've added some comments from #4 but
$ grep -ir "get('system.theme'" *needs a checkup.Back to the bot.
Comment #7
clemens.tolboomArgh ... Fixed Exception attempt #2
Should one use
Scanning code I find no core usage. Scanning for
new Exception(andnew \Exception(I find both.Comment #9
clemens.tolboomFailures are
It has no assertions!
It now needs a try catch? Does it?
Hmmm ... it's a UnitTestCase ... how can that enable `theme_test' module? Weird.
Tries to enable bartik. Same as the above.
Comment #10
dawehnerA LOT of unit tests don't have ... you work with mocks to check that it works.
In this example it uses the following annotations:
this does basically what you think as try/catch.
You don't ...
Have a look at
... switching this two code blocks should just work.
This changes seems 100% out of scope.
Should we also take care of checking whether the default theme is enabled?
Comment #11
clemens.tolboomI've removed the bad part.
I've added a getMockTheme so the so code reduces some and make it's intent more obvious.
I still failed to get the tests running correctly. That's partly due to the error messages being empty in the test UI giving not much clues (doh).
core$ php vendor/phpunit/phpunit/phpunit.php tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.phpgives more hints but I probably made 1 mistake with a refactoring.Some mocks add stylesheets and other settings which seems not important for the test which I don't get either.
I could use some more help :-/
Comment #12
clemens.tolboom@dawehner++
Thanks for your explanation in #10. It's nice to learn everyday a little.
Comment #14
dawehnerYeah phpunit should just not be runned from the simpletest UI. This integration just exists for the testbot.
Comment #15
clemens.tolboomI've added 2 tests: setDefault to and enable a non-existing theme
We still have two remaining tasks.
Comment #16
clemens.tolboomWe have no code for missing base theme in ThemeHandler.
This record from the test should fail IMHO.
What do you think?
Comment #17
dawehnerI wonder what should happen if the theme exists but is simply not enabled.
All the work you have done is great, also this idea, though we should better stop at some point and continue to work on a follow up?
Comment #18
clemens.tolboomI'm not sure whether this issue is complete yet.
In #10 and in #17 we have the 'Check for not enabled'
And is the
ThemeHandlerInterfacerich enough? Shouldn't we addI'm willing to add these but I agree with "Could be done through follow-ups".
Comment #19
clemens.tolboomI've added the get|set|is-Admin() and isDefault() to the interface and wrote the implementations.
As we are stalling themers to build sub themes let's get this one in.
The followup for this issue is #2176355: Followup: rewrite remaining code to use themehandler get|set|is for default and admin
Comment #20
dawehnerLets's maybe also step back and think whether the ThemeHandler should contain these values. The default/admin theme is a concept which is just used by theme negotiators but nothing else.
Comment #21
clemens.tolboom@dawehner in #2
I disagree with these getting removed as it makes a lot of code cleaner as sketched in #2176355: Followup: rewrite remaining code to use themehandler get|set|is for default and admin
Comment #22
clemens.tolboomComment #23
dawehnerIt would be great to get some oppinions from other people on that. I don't want to be the bad guy, I was just thinking about it.
Comment #24
Noe_ commentedWhy is this an Exception and not a ThemeDoesNotExistException?
Comment #25
clemens.tolboom@Noe_ thanks for finding. Feel free to patch too :)
Comment #26
joelpittetThis is a bug report and it looks like it's including things that are not necessary to fix the bug.
If we can get back to just the bug fix we may be able to get this in the 8.0.x branch but without that it's going to be pushed to 8.1.x as a feature request.
Also the indent is not following Drupal coding standards for the next one to write a patch for this.
I agree with @dawehner we should step back a bit on this. And leave the stuff from #2176355: Followup: rewrite remaining code to use themehandler get|set|is for default and admin to that issue's scope.
Comment #38
quietone commentedThis was fixed in 8.x #1067408: Themes do not have an installation status
Therefore, closing as outdated. If this is incorrect reopen the issue, by setting the status to 'Active', and add a comment explaining what still needs to be done.
Thanks!