On request from chx based on http://code.google.com/p/google-highly-open-participation-drupal/issues/...
Drupal 6 supports content (node) translation out of the box with the included
content translation module. This task is to write unit tests to ensure this
functionality works.
The Simpletest module provides a framework for running automated unit
tests in Drupal. Unit testing involves taking a small portion of code, a
unit, and subjecting it to programmatic tests to prove its correctness.
This can be extremely useful to help insure that new code does not
introduce bugs into existing functionality. Thus, having a full suite of
unit tests for Drupal 6.x core functionality using the Simpletest module
would be a major step forward for the project and would help insure that
only high-quality code is committed. In addition to helping developers
test their code, new tests for core Drupal functionality will be used for
automated testing by http://testing.drupal.org.
For this task, you need to first install and familiarize yourself with the
simpletest module (use the cvs HEAD version with Drupal HEAD/6.x RC):
http://drupal.org/project/simpletest
http://drupal.org/simpletest
http://www.lullabot.com/articles/introduction-unit-testing
The main work for this task is to write a small suite of tests to check
the functionality of translation module with a test site setup to have at
least two languages and both locale and translation module enabled. The
test case should:
* set the Story content type to be multilanguage enabled with translation
* create a story in one of the languages
* submit a translation of the story in one of the other languages
* update the original story and mark the translation outdated
* update the translation and mark it as up-to-date
Proper validation of your new tests will ideally include changing the
Drupal core code to break the tested functionality and then confirming
that your tests report a failure. Ideally, post each such change as a
patch to help the reviewers.
This suite should be written as a single .test file and should achieve
RTBC status in the Simpletest module issue queue.
Comment | File | Size | Author |
---|---|---|---|
#12 | translation_module5.test_.txt | 6.06 KB | boombatower |
#8 | translation_module4.test_.txt | 6.06 KB | boombatower |
#6 | translation_module3.test_.txt | 5.72 KB | boombatower |
#4 | drupal_test_case.php_.patch | 881 bytes | boombatower |
#4 | translation_module.test_.txt | 4.76 KB | boombatower |
Comments
Comment #1
chx CreditAttribution: chx commentedComment #2
aclight CreditAttribution: aclight commentedThe official GHOP task related to this issue can be found at:
http://code.google.com/p/google-highly-open-participation-drupal/issues/...
Comment #3
webchickMoving to SimpleTest queue.
Comment #4
boombatower CreditAttribution: boombatower commentedAfter having a few problems I was able to come up with a solution, in part thanks to figuring out what wasn't causing it with cwgordon7 in IRC. To complete my task I created a patch for the
drupal_test_case.php
file.I believe the submission meets all the requirements, but I am not sure if there is a way to do it without the patch.
Comment #5
Rok Žlender CreditAttribution: Rok Žlender commentedAs always you have produced a great test. My comments:
I've put your drupalGet change into its own issue so it doesn't get overlooked. I'll commit it together with your test when you fix ^^.
Comment #6
boombatower CreditAttribution: boombatower commentedI believe I fixed everything you requested.
I didn't use
$this->assertText()
since I used thet()
around the messages since they are core messages are translated depending on the environment.t()
adds HTML so I used$this->assertWantedRaw()
.Comment #7
Gábor HojtsySome comments:
- code looks good
- there are some coding stye mistakes (dots and whitespace; comments should start with capital letters and end in a dot)
- "create store in english" :)
- after you edit the translation, let's check the translations tab and see whether it shows that the translation was marked outdated, this is quite important functionality to validate
- You use t() like t('The language %lang has been created and can now be used.', ...) but my quick grep did not show and such string in Drupal 6. I found t('The language %language has been created and can now be used. More information is available on the help screen.', ...) though. When you use t(), if you intend to actually get a translation, you should use the exact same string, or your test will fail unless it runs on an English interface. (Looks like your test does not make sure it runs on an English site, rightly so :) Note that I did not check all strings but this caught my attention.
Comment #8
boombatower CreditAttribution: boombatower commentedI believe I fixed all the requested items.
Just as a note the accompanying patch is located here: http://drupal.org/node/209297.
Comment #9
Gábor HojtsyThere are still coding style issues in the test (just run coder module on it), but otherwise looks good to me on review. As far as I see, just fix the style issues and then get this RTBC.
Comment #10
boombatower CreditAttribution: boombatower commentedI downloaded and ran the Coder module on my test case and it returned the following results.
So I am not sure what I need to fix.
Comment #11
Gábor HojtsyStuff like
$this->drupalPostRequest('node/' . $node->nid . '/edit', $edit, 'Save');
is not comformant to our coding style, please use coder module's more sensitive checking (which is not enabled by default AFAIR).Comment #12
boombatower CreditAttribution: boombatower commentedI fixed the small appending dot style issues.
Comment #13
Gábor HojtsyI did not have the opportunity to test, but otherwise this all looks good to me now. Thanks for your work!
Comment #14
Rok Žlender CreditAttribution: Rok Žlender commentedCommitted. Thanks boombatower for your code and thanks Gabor for your reviews.
Comment #15
Rok Žlender CreditAttribution: Rok Žlender commentedComment #16
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.