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.

Comments

gábor hojtsy’s picture

StatusFileSize
new1.7 KB
new15.15 KB

In 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.

gábor hojtsy’s picture

StatusFileSize
new0 bytes
new5.01 KB

Rename 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.

gábor hojtsy’s picture

StatusFileSize
new964 bytes
new20.43 KB

It 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.

Status: Needs review » Needs work

The last submitted patch, move-negotiation-tests-3.patch, failed testing.

gábor hojtsy’s picture

Status: Needs work » Needs review
StatusFileSize
new0 bytes
new974 bytes

Unfortunately 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).

gábor hojtsy’s picture

StatusFileSize
new20.62 KB

Meh. Empty patch again. (Note to self: train eye to look at file size :).

Status: Needs review » Needs work

The last submitted patch, move-negotiation-tests-5.patch, failed testing.

gábor hojtsy’s picture

Would also need a reroll likely now that #1539072: Support for disabled languages broken, drop it landed.

DickJohnson’s picture

StatusFileSize
new21.21 KB

Added some permissions to the locale module -part Gabor just wrote about.

gábor hojtsy’s picture

Status: Needs work » Needs review

Moving back to needs review for testbot.

Why is this line in the patch, if there are no changes?

-    $admin_user = $this->drupalCreateUser(array('administer languages', 'translate interface', 'access administration pages', 'administer blocks'));
+    $admin_user = $this->drupalCreateUser(array('administer languages', 'translate interface', 'access administration pages', 'administer blocks'));

Status: Needs review » Needs work

The last submitted patch, move-negotiations-patch-6_0.patch, failed testing.

DickJohnson’s picture

Status: Needs work » Needs review
StatusFileSize
new20.92 KB

Removed extra lines.

Status: Needs review » Needs work

The last submitted patch, move-negotiations-patch-7.patch, failed testing.

DickJohnson’s picture

Status: Needs work » Needs review
StatusFileSize
new20.92 KB

Erm. Dunno how I managed to change the name of file without even changing it. So, let's try again.

Status: Needs review » Needs work

The last submitted patch, move-negotiations-tests-7.patch, failed testing.

gábor hojtsy’s picture

The filename does not matter as long as its .patch. I guess you might have edited the file directly instead of rolling it with git?

gábor hojtsy’s picture

Status: Needs work » Needs review
StatusFileSize
new20.45 KB
new755 bytes

So 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.

gábor hojtsy’s picture

StatusFileSize
new83.15 KB

Same 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? :)

xjm’s picture

It 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.

gábor hojtsy’s picture

#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*.

gábor hojtsy’s picture

StatusFileSize
new18.23 KB

Set 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).

xjm’s picture

StatusFileSize
new80.92 KB

Attached patch uses renames = copies for easier review.

Info:

# On branch 8.x
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   core/modules/language/language.test
#	new file:   core/modules/language/tests/language_test.info
#	renamed:    core/modules/locale/tests/locale_test.module -> core/modules/language/tests/language_test.module
#	modified:   core/modules/locale/locale.test
#	deleted:    core/modules/locale/tests/locale_test.info
#	modified:   core/modules/path/path.test
xjm’s picture

Status: Needs review » Needs work

Alright, I finally had time to review this.

  1. I reviewed all the changes in #21, and they look correct, aside from a minor formatting issue:
    +++ b/core/modules/locale/locale.testundefined
    @@ -3158,14 +3161,14 @@ class LocaleLanguageNegotiationInfoFunctionalTest extends DrupalWebTestCase {
    +    // Disable language_test and check that everything is set back to the original
    

    This comment is too long when updated; it needs to be rewrapped.

  2. I also applied #22 locally and found a stray reference to locale in the docblock for languageNegotiationUpdate():
       * Manually invoke locale_modules_enabled()/locale_modules_disabled() since   
       * they would not be invoked after enabling/disabling language_test the first
       * time. 

    The test actually uses language_modules_enabled() and language_modules_disabled(), as far as I can tell.

  3. I checked with the patch applied and there are no stray remaining references to locale in the test module.
  4. Finally, I reviewed #22 and have one question:
    +++ b/core/modules/locale/locale.testundefined
    @@ -2929,7 +2274,7 @@ class LocaleCommentLanguageFunctionalTest extends DrupalWebTestCase {
       function setUp() {
    -    parent::setUp('locale', 'locale_test');
    +    parent::setUp('locale', 'language_test');
    
    @@ -2944,7 +2289,7 @@ class LocaleCommentLanguageFunctionalTest extends DrupalWebTestCase {
         // Enable content language negotiation UI.
    -    variable_set('locale_test_content_language_type', TRUE);
    +    variable_set('language_test_content_language_type', TRUE);
    

    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?

  5. There are plenty of lines in #22 that have ishy docs, but I confirmed that the lines are moved only and working patches for them are already being written (see issues linked in #19), so I am ignoring them here because this supposedly simple issue is already complicated enough. :)
gábor hojtsy’s picture

StatusFileSize
new1.68 KB
new18.58 KB

Thanks! Fixed #1 and #2. Added this comment for #3:

    // We also use language_test module here to be able to turn on content
    // language negotiation. Drupal core does not provide a way in itself
    // to do that.
    parent::setUp('locale', 'language_test');

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).

gábor hojtsy’s picture

Status: Needs work » Needs review

(The patch did not include the test moves, I'll create a patch with that once this looks good :).

jcisio’s picture

Assigned: Unassigned » jcisio
jcisio’s picture

#24: move-negotiation-tests-24.patch queued for re-testing.

jcisio’s picture

Assigned: jcisio » Unassigned
Status: Needs review » Needs work

I 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.

xjm’s picture

Assigned: Unassigned » jcisio
Status: Needs work » Needs review

Alright, 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. :)

xjm’s picture

Assigned: jcisio » Unassigned

Crosspost.

gábor hojtsy’s picture

StatusFileSize
new44.65 KB

Ok, same patch now with actually moving the tests too. Given the actual test changes were reviewed, should be good I hope :)

xjm’s picture

Status: Needs review » Needs work

That 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. Maybe language.test was not staged?

gábor hojtsy’s picture

Status: Needs work » Needs review
StatusFileSize
new81.09 KB

Meh, right, language.test was not even included with the patch :/ This one has it. Sorry.

Status: Needs review » Needs work

The last submitted patch, move-negotiation-tests-33.patch, failed testing.

gábor hojtsy’s picture

Status: Needs work » Needs review
StatusFileSize
new78.58 KB

Patch did not apply due to #1497230: Use Dependency Injection to handle object definitions committed about 90 min ago :)

xjm’s picture

Status: Needs review » Needs work

Now the LanguagePathMonolingualTestCase is added to language.test but PathMonolingualTestCase is not removed from path.test. Did that file perhaps not get staged either?

Also, the patch does not apply anymore again. :(

gábor hojtsy’s picture

Status: Needs work » Needs review
StatusFileSize
new81 KB

This 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 :/

gábor hojtsy’s picture

Issue tags: -D8MI, -sprint, -language-base

#37: move-negotiation-tests-37.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +D8MI, +sprint, +language-base

The last submitted patch, move-negotiation-tests-37.patch, failed testing.

gábor hojtsy’s picture

Status: Needs work » Needs review
StatusFileSize
new81 KB

Reroll since this did not apply anymore due to #1552236: Move user language tests to user module being committed. Should be good, no?

gábor hojtsy’s picture

#40: move-negotiation-tests-40.patch queued for re-testing.

kalman.hosszu’s picture

Status: Needs review » Reviewed & tested by the community

The tests are passed and I think that the code is good, so I change the status to RTBC.

catch’s picture

Issue tags: -D8MI, -sprint, -language-base

#40: move-negotiation-tests-40.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work
Issue tags: +D8MI, +sprint, +language-base

The last submitted patch, move-negotiation-tests-40.patch, failed testing.

gábor hojtsy’s picture

Status: Needs work » Needs review
StatusFileSize
new81.17 KB

Rerolled. 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.

Status: Needs review » Needs work

The last submitted patch, move-negotiation-tests-45.patch, failed testing.

gábor hojtsy’s picture

Status: Needs work » Needs review
StatusFileSize
new81.33 KB

All right, unittestbase not needed in locale.test anymore, needed in language.test now though.

Status: Needs review » Needs work

The last submitted patch, move-negotiation-tests-47.patch, failed testing.

gábor hojtsy’s picture

Status: Needs work » Needs review
StatusFileSize
new81.32 KB

The path test that was moved did not get its base class updated.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Please commit.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Yep. Committed/pushed to 8.x.

gábor hojtsy’s picture

Issue tags: -sprint

Yay, finally, thanks.

webchick’s picture

FYI: 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.

webchick’s picture

Hm. 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.

Automatically closed -- issue fixed for 2 weeks with no activity.