With the negotiation moved to language module and other module specific code moved to the respective modules (user, path, node, etc), it is time to continue with moving the tests to the right place too. We skipped moving tests earlier because (a) multiple pieces were in flux moving around and tests depend on different things (b) the patches were big enough and easily failed on small changes.
This patch is about moving the language negotiation related tests into the language module as well. Starting off by moving the locale_test.module and locale_test.info that were 100% about negotiation to language module. Did not move the tests yet, so we can see the extent of the changes required in tests, and see that they still work.
| Comment | File | Size | Author |
|---|---|---|---|
| #49 | move-negotiation-tests-50.patch | 81.32 KB | gábor hojtsy |
| #47 | move-negotiation-tests-47.patch | 81.33 KB | gábor hojtsy |
| #45 | move-negotiation-tests-45.patch | 81.17 KB | gábor hojtsy |
| #40 | move-negotiation-tests-40.patch | 81 KB | gábor hojtsy |
| #37 | move-negotiation-tests-37.patch | 81 KB | gábor hojtsy |
Comments
Comment #1
gábor hojtsyIn fact locale_test.module is no more after the patch, so it would not make sense to reference it anymore or try to look up its directory. We have loaded it for tests where I don't see why it would have been needed (I think that is only copy-paste cruft there) and referenced the JS and translation dir explicitly.
Comment #2
gábor hojtsyRename related testcases in preparation for language module move. Depend them on language module vs. locale module. The affected testcases are intermixed with other testcases working with content, users, paths, UI translation in locale.module. The content, user, path, etc. tests should be moved to the respective modules in other issues.
Comment #3
gábor hojtsyIt is not really surprising a 0 byte patch would pass :D Here is it again with a little bit more change in path tests which also has one piece that should be with language module instead.
Comment #5
gábor hojtsyUnfortunately one of the negotiation tests also marginally use localization to test that the right language was used. I think it can still go to language module tests, since we categorize tests by their main functionality. Ie. locale tests use path module and sometimes vice versa; it is the main focus of the test that makes it put where it is. (Still not actually moving the tests, so all changes are directly visible that are required to be moved).
Comment #6
gábor hojtsyMeh. Empty patch again. (Note to self: train eye to look at file size :).
Comment #8
gábor hojtsyWould also need a reroll likely now that #1539072: Support for disabled languages broken, drop it landed.
Comment #9
DickJohnson commentedAdded some permissions to the locale module -part Gabor just wrote about.
Comment #10
gábor hojtsyMoving back to needs review for testbot.
Why is this line in the patch, if there are no changes?
Comment #12
DickJohnson commentedRemoved extra lines.
Comment #14
DickJohnson commentedErm. Dunno how I managed to change the name of file without even changing it. So, let's try again.
Comment #16
gábor hojtsyThe filename does not matter as long as its .patch. I guess you might have edited the file directly instead of rolling it with git?
Comment #17
gábor hojtsySo as said above LanguageNegotiationTestCase (formerly LocaleUILanguageNegotiationTest) needs the 'translate interface' permission. I fixed the locale dependency of that partially in #6 but did not add this permission back. Rerolled from #6 because interim patches were in wrong format.
Comment #18
gábor hojtsySame thing but now actually moving the tests too. If #17 looks fine, this should be committable :) Please review! This is a very simple thing, should not take much time, right? :)
Comment #19
xjmIt would be helpful to have a diff that just shows the changes to the code other than the fact that is is moved; I'll try making that to make review easier. :)
See also #1326618: Clean up API docs for locale module and #1392962: Clean up API docs for the language module.
Comment #20
gábor hojtsy#17 is almost what you are asking for and was purposefully limited to just that diff :) It does include a move of locale_test module to language_test, and its just replacing 'locale_test' with 'language_test' in function prefixes and tiny changes in the description in the info file. No code change to the test module *at all*.
Comment #21
gábor hojtsySet renamed = copies in my git setup as per http://drupal.org/node/1542048 on suggestion from @xjm to make it easier to review the .module file changes (which as said are only as required). It did not recognize the .info file as renamed I guess due to the relatively high amount of change (locale => language) in the file. So rerolled #17 with that.
Any comments on the changes so we can roll a patch which really moves stuff? :) (renames = copies would not help with moving the tests themselves, since they are not files).
Comment #22
xjmAttached patch uses
renames = copiesfor easier review.Info:
Comment #23
xjmAlright, I finally had time to review this.
This comment is too long when updated; it needs to be rewrapped.
languageNegotiationUpdate():The test actually uses
language_modules_enabled()andlanguage_modules_disabled(), as far as I can tell.This is in
LocaleMultilingualFieldsFunctionalTest. Is this a test that didn't get moved, or is there a reason we're using language_test stuff in locale tests? Should we add an inline comment if the latter?Comment #24
gábor hojtsyThanks! Fixed #1 and #2. Added this comment for #3:
The language negotiation functionality is in language module (and is tested more directly in LanguageNegotiationInfoTestCase which also turns on content language negotiation via language_test.module. Locale module depends on language module, so I think as long as a test relies on locale module to do things, it could just as well rely on language module provided stuff too (such as its test utilities).
Comment #25
gábor hojtsy(The patch did not include the test moves, I'll create a patch with that once this looks good :).
Comment #26
jcisio commentedComment #27
jcisio commented#24: move-negotiation-tests-24.patch queued for re-testing.
Comment #28
jcisio commentedI review and the patch looks good. I don't know why there are many test fails locally, but test bot feels good, so making as need works for Gábor to roll a full patch with moves.
Comment #29
xjmAlright, this looks pretty good to me now. Ideally it would be either "language_test.module" or "the language_test module," I think. Or well, actually, it would ideally be "the Language Test module" now that we've changed our capitalization standard (and we'd change that elsewhere as well) but that's really out of scope. :)
Comment #30
xjmCrosspost.
Comment #31
gábor hojtsyOk, same patch now with actually moving the tests too. Given the actual test changes were reviewed, should be good I hope :)
Comment #32
xjmThat patch looks like it's missing a lot... lines are deleted but not added back. I confirmed this with a diff locally; the whole of
LanguageNegotiationInfoTestCase,LanguageUrlRewritingTestCase,LanguageNegotiationTestCase, etc. are not in #31. Maybelanguage.testwas not staged?Comment #33
gábor hojtsyMeh, right, language.test was not even included with the patch :/ This one has it. Sorry.
Comment #35
gábor hojtsyPatch did not apply due to #1497230: Use Dependency Injection to handle object definitions committed about 90 min ago :)
Comment #36
xjmNow the
LanguagePathMonolingualTestCaseis added tolanguage.testbutPathMonolingualTestCaseis not removed frompath.test. Did that file perhaps not get staged either?Also, the patch does not apply anymore again. :(
Comment #37
gábor hojtsyThis did not apply due to #1183208: Remove variable_get('clean_url') and switch to index.php/path pattern for dirty URL support. Rerolled. Should hopefully get in before it conflicts again :/
Comment #38
gábor hojtsy#37: move-negotiation-tests-37.patch queued for re-testing.
Comment #40
gábor hojtsyReroll since this did not apply anymore due to #1552236: Move user language tests to user module being committed. Should be good, no?
Comment #41
gábor hojtsy#40: move-negotiation-tests-40.patch queued for re-testing.
Comment #42
kalman.hosszu commentedThe tests are passed and I think that the code is good, so I change the status to RTBC.
Comment #43
catch#40: move-negotiation-tests-40.patch queued for re-testing.
Comment #45
gábor hojtsyRerolled. Please, pretty please I beg you commit this before applying all kind of other fun patches that necessitates painful rerolls. I'm tired of this.
Comment #47
gábor hojtsyAll right, unittestbase not needed in locale.test anymore, needed in language.test now though.
Comment #49
gábor hojtsyThe path test that was moved did not get its base class updated.
Comment #50
gábor hojtsyPlease commit.
Comment #51
catchYep. Committed/pushed to 8.x.
Comment #53
gábor hojtsyYay, finally, thanks.
Comment #54
webchickFYI: There's a tag "Avoid commit conflicts" for patches like this. http://drupal.org/project/issues/search/drupal?issue_tags=Avoid+commit+c... See definition at http://drupal.org/node/1207020.
Comment #55
webchickHm. Well. Maybe not for patches like this. I guess all it's doing is moving tests around, so it makes sense to commit more important stuff ahead of it.