This unfortunate SNAFU: http://drupal.org/node/208700 demonstrates again the need for unit tests for the filter module.
Deliverables:
Your overall task will be to create a set of tests that thoroughly tests the administrative interface of the filter module. This suite should be written as a single .test file and should achieve RTBC status.
Suggested tests/components to be written for this task:
1. Save all the original settings (e.g. you might even rename and duplicate the table) so you can revert to them.
2. admin/settings/filters change the default filter by POST. Check that the new default shows up and cannot be deleted.
3.admin/settings/filters/1/configure Add an additional tag, check that is shows up, and check that the filter cache is cleared
4 admin/settings/filters/1/order reorder the input formats by POST, and check that the changes are saved.
5. settings/filters/add add a new input format by POST and check that it is saved and has all selected options
6.settings/filters/delete/x check that the newly added format can be deleted
7. admin/settings/filters/2 allow authenticated users, log in as a normal user and check access to the filter.
Note, you can assume the default filtered and full HTML filters are 1 and 2 (though bonus points for checking or making it so). Revert to the original filters when you are done.
Your test should either work for Drupal 5.x as well as 6.x, or provide both 5.x and 6.x versions.
Note each of these 3 tests should include at least 3 to 8 assertions that are checked. 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.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | filter_module.test_.txt | 7.71 KB | gribnif |
| #10 | drupal_test_case.diff | 411 bytes | boombatower |
| #8 | filter_module.test_.txt | 7.71 KB | boombatower |
| #8 | drupal_test_case.diff | 327 bytes | boombatower |
| #7 | filter_module.test_.txt | 7.3 KB | boombatower |
Comments
Comment #1
pwolanin commentedGHOP issue: http://code.google.com/p/google-highly-open-participation-drupal/issues/...
Comment #2
boombatower commentedI got the 6.x test working fine, but 5.x doesn't want to work.
It doesn't seem like logout works, or that
drupalGetcorrectly...I'm not exactly sure.So i'm not sure what exactly to do with the 5.x test.
Comment #3
boombatower commentedI think I figured the stuff out. This test should work for both 6.x and 5.x
Comment #4
boombatower commentedRemoved enabling of filter since it must be enabled for Drupal to run.
Comment #5
boombatower commentedChanges requested by pwolanin in IRC:
Comment #6
pwolanin commentedcode style problems - use {} with all if/else statements. For example:
needs to be:
Comment #7
boombatower commentedThis should do it.
Comment #8
boombatower commentedI made the following changes after talking with chx in IRC:
Comment #9
chx commentedNote that the patch for D5 simpletest is submtited reversed. It also could use a $query = NULL parameter.
Comment #10
boombatower commentedHere is the updated diff.
Comment #11
gribnif commentedThis is a version of the tests, updated to work with HEAD. It accounts for the name change in the drupalPostRequest function, and changes in the submit button text. More unit tests to follow.
Comment #12
boombatower commentedCommitted.
In future this test will probably be made HEAD specific, removing all 5.x stuff.
@Gribnif: Thanks for updating test.
Comment #13
boombatower commentedDouble post.
Comment #14
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.