This patch checks permissions passed to drupalCreateUser to ensure that invalid permissions aren't accidentally used.
This is very helpful in spotting out-dated tests and typos.
Requested by Dries http://drupal.org/node/266539#comment-871680, but mentioned several times before.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | simpletest_check_permissions.patch | 4.66 KB | boombatower |
| #1 | simpletest_check_permissions.patch | 1.86 KB | boombatower |
Comments
Comment #1
boombatower commentedHmm...patch was there when I previewed.
Comment #2
webchickOh, *awesome*!
One suggestion I have is to add static caching to that $available array. It's probably expensive to re-generate that each time drupalCreateUser is called.
see http://www.lullabot.com/articles/a_beginners_guide_to_caching_data for more info.
Comment #3
webchickOh, also, you're missing a patch to simpletest.test to make sure this function is working properly. ;)
Comment #4
damien tournoud commentedHum. Just a though here, why not implement that check in
user_access()in order to enforce it everywhere in Drupal? I remember that this loosely typed permission bit me several times.Comment #5
boombatower commentedUpdated to include test and caching.
Comment #6
boombatower commentedAny thoughts on #4. I would be for it.
Comment #7
dries commentedI would leave #4 for another issue. I'm not sure I'd want to check the permissions for every page view. I'd try to work it into devel.module or so.
Comment #8
boombatower commentedOk, so any reviews? :)
Comment #9
catchIt's a good idea and all the tests pass, RTBC.
Comment #10
dries commentedCommited to CVS HEAD. Thanks again, boombatower.
Comment #11
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.