Problem/Motivation
1. There is no test coverage for theme's supporting *.config_translation.yml files on them.
2. The support for themes was disabled in #2123575-16: Fixes for tim.plunkett and dawehner review due to conflicts with unit testability. Figure out a way to make unit tests work with this.
Proposed resolution
1. Add coverage with a test theme.
2. Expert advice welcome! We can add our own wrapper class for list_themes() but that sounds pretty awful :/ We could also postpone theme support on core converting this to a service, but that also sounds awful.
Remaining tasks
Figure out fix for 2.
User interface changes
None.
API changes
None.
Related Issues
Comment | File | Size | Author |
---|---|---|---|
#38 | test-theme-38.patch | 4.26 KB | Gábor Hojtsy |
#19 | test-theme-11.patch | 9.16 KB | Gábor Hojtsy |
#19 | interdiff.txt | 2.6 KB | Gábor Hojtsy |
#17 | test-theme-10.patch | 6.56 KB | Gábor Hojtsy |
#17 | interdiff.txt | 898 bytes | Gábor Hojtsy |
Comments
Comment #1
Gábor HojtsyThis should still fail on the unit tests due to the problem with lack of ways to mock list_themes() but hopefully will pass the theme .yml test that is newly added. Untested :)
Comment #2
Gábor HojtsyFix info file end newline.
Comment #4
Gábor HojtsyWe need to implement hook_system_theme_info() to expose this theme actually because its buried under a module.
Comment #6
Gábor HojtsyThe test needs to log in with a user that can actually visit that page, and then fine :) The other changes in the interdiff are just info file cleanup stuff.
Comment #8
Gábor Hojtsy#2109287: Replace list_themes() with a service. exists and would allow us to properly fix that unit test in the best way. In the meantime we can work around that by injecting a custom wrapper for theme listing and mocking that. We need to register that as a service, so we can pass it on, so we can mock it, etc. This looks like maybe a bit too much just so we can keep unit testing the manager. Expert feedback welcome :)
Comment #9
Gábor HojtsyMissed variable name on docs.
Comment #11
Gábor HojtsySo I forgot to add in the new service on the test constructor. Anyway, @dawehner pointed out I should use an easier method. Just subclass the class being tested and override a method where I put the global stuff :D So here you go. The ConfigMapperThemeDiscovery is also removed, not in the interdiff, sorry, screwed up there.
Comment #12
Gábor HojtsyShould not reference the non-existent theme discovery service anymore :D
Comment #13
dawehnerLooks perfect if it passes the great testbot barrier.
Comment #15
Gábor HojtsyNeed to have the signatures match obviously :) Still cannot run locally nicely, so not 100% sure it will be green.
Comment #17
Gábor HojtsyNeed to mock drupal_get_path() too. Works for me locally now.
Comment #19
Gábor HojtsyNow needs to be updated for #2048223: Add $account argument to AccessCheckInterface::access() method and use the current_user service, since the tests will not pass anymore due to difference in the interface. Heh :D
Comment #21
Gábor HojtsyCommitted the #19 interdiff only (to fix core related update needed at http://drupalcode.org/project/config_translation.git/commitdiff/8e3dbfee...).
Rerolled without that. It ran properly on my machine with a full phpunit pass. Not sure why is it not finding the class still. I'll need to update a core checkout, etc. later on. Meh. No time anymore today.
So this should be the same as #17 since I committed the access interface fix, which was truly unrelated.
Comment #23
dawehnerPuh, this could be an issue with the way how contrib modules phpunit test are integrated into simpletest.
Comment #24
Gábor HojtsyRerolled after the turbulent fails of core changes are now fixed on the module. No change.
Comment #26
Gábor HojtsyCould this be a PHP 5.3 problem? I'm running it locally on:
and it passes fine:
Comment #27
Gábor Hojtsy24: test-theme-13.patch queued for re-testing.
Comment #28
Gábor HojtsyAlso here is a copy with just the added test theme that should still pass. We can get that committed in the interim, so the patch to review is smaller and less intimidating :)
Comment #30
Gábor Hojtsy28: test-theme-only.patch queued for re-testing.
Comment #32
Gábor Hojtsy@timplunkett points out a small error in the test (which should not lead to the fail indicated by testbot though). Fixing that at least. If this only fails with the 5 fails on access() interface that is due to #2125349: Testbot not testing contrib 8.x with up to date 8.x core? This is derived from #24, the interim patch was just a test to get something simpler pass but it exhibited the same testbot bug from #2125349: Testbot not testing contrib 8.x with up to date 8.x core?.
Comment #33
Gábor HojtsySend for testbot.
Comment #35
Gábor HojtsyRerolled patch since the above one did not apply anymore. (I committed the .info.yml file fix for the test module as an innocent commit to kick off testbot's happy green test following a testbot bug :D).
Comment #37
Gábor HojtsyWant to commit at least a logical part that in itself passes. The theme only should :D
Comment #38
Gábor HojtsySo now only the test remains. Easier to review, but will fail on testbot :/ Does not fail locally.
Comment #40
dawehnerI just went to https://drupal.org/project/project_issue_file_review in order to search how contrib modules are tested:
so let's see what happens if you do the same on the shell:
... there we go!
simpletest_script_get_test_list() parses that list, so all we have to check is whether the class is either extending TestBase or UnitTestCase, yeah!
Here is a core issue: #2129197: Testbot (run-tests.sh with --file) attempts to run non-test classes, fails
Comment #41
Gábor HojtsyThe fix in #2129197: Testbot (run-tests.sh with --file) attempts to run non-test classes, fails works nicely, it looks great. RTBC-ed. Let's get that in, so we can get this in, so we can get the config translation in, so we can uncover more bugs :D
Comment #42
Gábor Hojtsy38: test-theme-38.patch queued for re-testing.
Comment #44
Gábor Hojtsy38: test-theme-38.patch queued for re-testing.
Comment #46
Gábor HojtsyYay, committed #38!