Closed (fixed)
Project:
SimpleTest
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
15 Dec 2007 at 02:27 UTC
Updated:
9 Jan 2008 at 17:12 UTC
Jump to comment: Most recent file
posting a GHOP task
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | modules.test.txt | 7.55 KB | Smartys-1 |
| #8 | modules.test.txt | 7.54 KB | Smartys-1 |
| #5 | modules.test.txt | 6.75 KB | Smartys-1 |
| #2 | modules.test.txt | 6.46 KB | Smartys-1 |
Comments
Comment #1
pwolanin commentedtask is here: http://code.google.com/p/google-highly-open-participation-drupal/issues/...
The main work for this task is to write a small suite of tests to check the
basic functionality at admin/build/modules. This suite should be written as
a single .test file.
Suggested tests:
1. Enable all core modules by POST - look for error messages, confirm table
creation, etc.
2. Attempt to enable a module with non-enabled dependencies, for example by
disabling comment and enabling forum. Use POST. Confirm expected error
message and that module is not enabled.
3. Disable and uninstall a module (such as aggregator) or better all
modules enabled in #1. Confirm table deletion, look for error messages, etc.
Comment #2
Smartys-1 commentedOK, I'm attaching the .test file containing the 3 testcases.
I can't generate diffs to break the test at the moment, but I can suggest how to break the tests:
Test 1:
- http://api.drupal.org/api/function/system_modules_submit/6
Change
to some other message.
- Comment out (same file)
Test 2:
- http://api.drupal.org/api/function/system_modules_confirm_form/6
Change the second parameter of confirm_form in the following block of code.
- Before that block of code, set $form to false
- http://api.drupal.org/api/function/system_modules_submit/6
Remove the return from
Test 3:
- http://api.drupal.org/api/function/system_modules_submit/6
Change
to some other message.
- Break/remove the uninstall hook for a module so that tables are not removed properly
- http://api.drupal.org/api/function/system_modules_uninstall_submit/6
Change
drupal_set_message(t('The selected modules have been uninstalled.'));Comment #3
pwolanin commentedComment #4
pwolanin commentedLooks like a good start - a few suggestions:
First off, for a more robust test, you should make sure that at least one of the modules that is to be enabled is not already enabled. If they are all enabled, you might directly disable a couple before starting the test (try using
$this->drupalModuleDisable();)To check that the modules are enabled, you should instead (or in addition) check the system table. Not all modules create tables - and if the module was previously enabled the table would already exist.
After posting to disable the modules, check the system table again to make sure the module is disabled.
Also, it would be simpler to use code like:
rather than:
I don't think tests usually implement
function tearDown(), and since you don't add any code, you can just omit them.Comment #5
Smartys-1 commentedThanks :)
I'm attaching a revised set of tests that incorporates your comments.
Comment #6
pwolanin commentedcode style: all indents should be 2 spaces
also, each assertion should have an informative message like:
Comment #7
Smartys-1 commentedFair enough, I'll get right on it :)
Comment #8
Smartys-1 commentedAnd revised. :)
Comment #9
Smartys-1 commentedI guess I should set this as well (it was set automatically before, how odd) :)
Comment #10
chx commentedSmartys, great work. A few comments: string concat code style, there is always a space on both sides of a dot but there is no space between a quote (single or double) and a dot. So
$edit['status['. $module .']'you lack 1-1 space. I would run coder module over this just to make sure there are no more code style violations. HEAD of coder works w/ D6.Comment #11
Smartys-1 commentedThanks a lot. :)
I just checked out the coder module from CVS and ran it (I had to move the .test file into the simpletest folder and give it a .php extension), but it didn't find any mistakes. I've made your changes though and the fixed version is attached.
Comment #12
chx commentedComment #13
pwolanin commented@Smartys - please post the final version to the GHOP issue
Comment #14
Smartys-1 commentedIt would be my pleasure :)
Comment #15
Rok Žlender commentedCommitted.
Comment #16
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.