#333060: Parent theme pattern clobbering is the perfect example of an issue that affects tweaky logic that only 2-3 people really understand and *really* needs to have regression tests to make sure it continues to work as intended. In fact, I would argue that 90% of the D6 theme system falls under this umbrella. ;)
It's challenging though because AFAIK we can't (currently) test the theme system in SimpleTest. It might be that the only problem is that we need hidden = TRUE recognized in .info files of themes? Or am I on crack and this is totally testable right now?
neclimdul has a nearly-complete test for this issue at http://drupal.org/node/333060#comment-1141774. Would love for the result of this issue to prove that this .zip file can be turned into a test that SimpleTest can run.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 343898-13-hidden-themes.patch | 2.6 KB | johnalbin |
| #8 | 343898-8.hidden-themes.patch | 2.59 KB | dww |
| #7 | 343898-7.hidden-themes.patch | 2.09 KB | dww |
| #6 | 343898-6-hidden-themes.patch | 842 bytes | johnalbin |
Comments
Comment #1
boombatower commentedThis was discussed about a year ago (never officially) and kinda fell by the wayside.
I think the best way to test the theme layer is to create a "SimpleTest Theme" which seems like the track you're on with
hidden = TRUE. Then implementing all possible override combinations and such and testing them by viewing the appropriate pages.It would be nice to have a $this->setTheme(); method so the setUp() for a theme test could look like
The SimpleTest theme should be very "computer friendly". Each template can simply place a wrapper div around content with an id value representing the template. Or if we don't care about HTML we can go XML route and just make the tag the template id.
Comment #2
webchickAnother really useful set of test themes that are catching all sorts of fun bugs: http://drupal.org/node/489762#comment-1711762
I'm escalating this to a critical bug report. It's something we really do need to figure out.
Comment #3
boombatower commentedSo what do we need? The tests can goto the theme page and change the active theme.
Please provide more details. The issue linked to has all passing tests?
Comment #4
webchickI'm not sure, but it's possible that all we basically need is for themes to respect the hidden = TRUE property in .info files and a way to programmatically enable hidden themes from within a test like we do modules. And maybe add another search path for themes (or maybe not if themes/tests/[theme-name] works). Most of these tests involve enabling themes that have particularly tricky bits in their .info files or preprocess functions and checking to ensure that things worked properly.
Comment #5
boombatower commentedI am for supporting hidden = TRUE in themes. I'll work on a patch shortyl.
Comment #6
johnalbinHere's the patch. :-)
I was surprised how easy this was to implement, but it was super easy to copy the necessary code from system_modules().
I think themes/tests/THEMENAME works. And we can't have just one simpletest theme because we need to test inheritance of base/sub themes.
Comment #7
dwwRerolled to fix a few code comments up Update status now that themes can be hidden, too (_update_process_info_list() is already ignoring them, but the comments assumed those where for hidden modules). I'm going to try writing a test for #456088: Sub-themes not notified of security updates for base themes that depends on this patch, and if that all works nicely, I'll mark this RTBC.
Comment #8
dwwNew patch that also adds a themes/tests/README.txt file. If you use this, you'll need:
Comment #9
dwwIt'd still be nice to have an easy way to enable these themes via test cases. For now, I'm just doing the following, which isn't ideal:
Otherwise, this is definitely working. I can add test themes under themes/tests/*, they don't show up at the "Appearance" page, but when I alter the .info files inside update status tests, it all works as expected. I'm tempted to mark this RTBC at this point, since we can always add the
$this->setTheme('theme_name')function later, or other support mechanisms to make this easier. But, without the basic plumbing of hidden themes and a themes/tests directory in core, we simply cannot write tests that involve themes...Comment #10
dave reidLooks like a good start. I say we followup here or in separate issues for DWTC->setTheme() and maybe a function that can be re-used by both module and theme listings to 'hide' required or testing projects.
Comment #11
dave reidComment #12
robloachComment #13
johnalbinVery minor text formatting change in themes/tests/README.txt to make it match the format of other README files in sites/all/. Otherwise identical, so still RTBC.
Comment #14
webchickOooh! Spiffy!! :D
Committed to HEAD! Can't wait for the follow-ups. :)
Comment #15
dwwSweet, thanks webchick!
First follow-up: #456088-30: Sub-themes not notified of security updates for base themes. Should be RTBC, although it's my patch so I didn't say so. ;)
Comment #16
dwwBTW, once #456088 lands (or any patch that adds some hidden test themes like this), we could add a test in theme.test to ensure that the hidden themes aren't showing up on the Appearance page. ;)
Comment #17
Anonymous (not verified) commentedHere's the setTheme method that's working for me:
Comment #19
rfayMarking for backport to D6. This is important stuff!
Comment #20
proppy commentedThe following code allow to set a new theme in simpletest D6 testcases:
Comment #21
boombatower commentedSeems like this is long since dead.