Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
theme system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
2 Jun 2015 at 05:52 UTC
Updated:
30 Jul 2015 at 19:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
honzakuchar commentedConfirmed on commit 8f9efdedddd5864b10ae7189b9a6f9296f1791eb
The error came from installation step. When you click install you get this error. (but theme installs) Clicking enables works without issues.
Comment #2
honzakuchar commentedComment #3
honzakuchar commentedComment #4
star-szrThanks @honzakuchar. Setting to needs review so it goes through the automated tests (aka testbot). And tagging because this needs test coverage.
Comment #5
honzakuchar commentedI'm not sure if it really needs test coverage. (writing new test for this) The code I've updated will be deleted in Drupal 9.0.
Where should go regression tests? Just into ThemeHandlerTest.php ?
Comment #6
honzakuchar commented@Cottser bump
Comment #7
David_Rothstein commentedThe first part of the patch looks good to me, and I verified that it fixes the bug - thanks!
I don't understand the second part though. The uninstall() method is not documented as having a return value, and the function it calls does not appear to return anything either...
Regarding tests, I think that would definitely be a good idea. The code comments just say that the code in question is deprecated, but certainly not the "Install and set as default" functionality itself. Also, Drupal 9 is a long way away :)
I think Drupal\system\Tests\System\ThemeTest is the right place to add a functional test. You can see in the testSwitchDefaultTheme() method that it already has one for switching the default theme via the "Set as default" link, so probably just needs a similar one for "Install and set as default".
Comment #8
star-szrYup, what David said. Thanks :)
Comment #9
RavindraSingh commentedThank you @David_Rothstein, I got a little idea based on your suggestion. just creating a tests for "Install and set a default" link. Please let me know if I should not create a new testfunctions. I will optimize the code once I get more clarification on this.
Added code looks like:
Logically I should not install bartik on this tests. i am already on admin/appearance page.
Comment #11
RavindraSingh commentedSeems some API also has been changed. So adding needs reroll
Comment #12
mesch commentedAs per #7, removed return from uninstall method, and added simpletest method to existing ThemeTest class.
Comment #13
darol100 commentedI have test this patch out #13 and seem to fix this issue.
Comment #14
wim leersA few nits, sorry.
HAH!
80 cols.
Needs a newline in between.
Comment #15
mesch commentedThanks @Wim Leers.
Addressed #2 and #3. Was #1 a "that was an easy fix" HAH or a "mesch, you did something silly" HAH? :)
Comment #16
star-szrYeah I'm pretty sure it's "HAH that was an easy fix" ;)
Couple more remaining nits:
Docblock usually start plural "Tests" per https://www.drupal.org/node/1354#functions. (I'm not an English major but this part - third person singular present tense verb).
Trailing whitespace here.
Comment #17
wim leersIndeed it was the positive one :)
Comment #18
darol100 commentedHere is the patch with #16 suggestions.
Comment #19
darol100 commentedComment #20
star-szrChanges look good, thanks @darol100, next time please provide an interdiff :)
I'm not sure that we've seen a test-only patch yet.
Can we get a test-only version of the patch posted, along with the same patch from #18? Like on the bottom of https://www.drupal.org/contributor-tasks/write-tests.
Comment #21
mesch commentedPer #20.
Comment #22
star-szrExcellent, that newline should be there :)
RTBC*, has tests and fixes the bug.
This should get kicked back to needs work because the test-only patch was uploaded second (upload it first to prevent this in the future). I do declare that anyone can re-RTBC it today on my behalf.
* The RTBC is also conditional on the test-only patch failing :)
Comment #25
star-szrSeems not worth retesting at this point, testbot is having a bad day.
Comment #28
star-szrTaking a chance, things seem to have calmed down somewhat.
Comment #30
star-szrNow as long as the testbot re-testing RTBC patches doesn't mess this up…
Comment #31
David_Rothstein commentedThis isn't a correct use of translations.
I think the simplest way to fix that is just to change it to
$this->assertText('Bartik is now the default theme.'). (Since it's running in the context of a test site, we know it will be in English.) A number of existing tests do it like that.Otherwise, all looks good. The rest of the test looks consistent with how the existing testSwitchDefaultTheme() test is done.
Comment #32
wim leersYep.
Comment #33
deepakaryan1988Comment #34
deepakaryan1988Addressing the fixes in #31
Comment #36
deepakaryan1988Fixing up!
Comment #37
star-szrWould the same comment apply here?
Comment #38
mesch commentedI find the simpletest documentation on t() is a bit unclear on when and where the strings are translated. The t() function is used elsewhere in this class (e.g.
testInvalidTheme()) withassertText()and likewise in the simpletest examples module.The alternative:
Comment #39
star-szrBut it should probably match the current translatable string in that case, which uses % and then you'd use assertRaw() instead I think. Not sure.
Comment #40
David_Rothstein commentedYeah, using the actual translatable string from the main codebase (plus switching to assertRaw if necessary) is another option.
For
'Bartik(' . t('active tab') . ')', I agree it looks suspicious also; I didn't comment on it earlier because the existing test does the exact same thing, so if it's a problem it's a preexisting one :)Comment #41
kattekrab commentedComment #42
cilefen commentedI do not see the value of loading the blocks admin page to check the default theme. This checks the appearance form output and for the regression caused by ThemeHandler::install() not returning anything. I am a bit of a mad wizard with regexes so somebody give it a hard look please.
Comment #44
cilefen commentedThis is less fragile.
Comment #46
almaudoh commentedHad this same issue, was looking to file a bug, then saw this issue. So I've done a manual test of patch #44. The patch fixes the issue for me and the test is great.
Comment #47
kattekrab commentedManual Test ok.
RTBC++
Comment #48
mangy.fox commentedManually tested patch #44 and works perfectly.
RTBC from me too.
Comment #49
alexpottThis fixes the bug and has a test - nice. Committed cffc13a and pushed to 8.0.x. Thanks!