Closed (fixed)
Project:
SimpleTest
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Feb 2009 at 00:05 UTC
Updated:
27 Mar 2009 at 03:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
boombatower commentedI don't have the module your testing with, but:
works.
Please include your full test and the module your using (link) so I can test.
Comment #2
berdirInteresting. I'm having the same or atleast similiar issues on my PC and my Laptop, both have the latest simpletest-6.x-2.x-dev installed.
The tests are part of a patch I'm working on, see #375999-8: #288183 followup: Developer friendlify privatemsg_new_thread API. .
Comment #3
boombatower commentedI can't seem to re-create this with anything other than your test and code.
This in D7 which requires a module to be enabled at setup and both permissions provided by that module is an identical case...it works. I'm not sure what to say...seems like some debugging is in order.
Edit: same test works in D6.
Comment #4
berdirAh, I found it.
It works fine if you have only one of those tests. However, If you have multiple of those tests and test directly and not over HTTP, the error happens.
And the reason for this is again the nemesis of tests... static cache. user_access stores the pemissions of each user in a static array, where uid is the key. However, a new test function creates new users in a new database.. and with the same uid's as before.
Suggestion for a workaround: Call user_access('', NULL, TRUE) in setUp() to reset the static cache. This may need to be done for other things too...
Another reason why we need a standardized static cache solution: #254491: Standardize static caching.
Comment #5
boombatower commentedYea it was kinda feeling like that. Good to know...so it would be really nice to the static stuff working.
How would you like to mark this issue?
Comment #6
berdirThis issue is about 6.x-2.x. And there will never be a centralized static cache solution in D6 so I think we need to add a workaround. It works fine to add the user_access reset call in the test code itself but this is easily forgotten and pretty hard to debug.
I can provide a patch if you like.
Comment #7
boombatower commentedPlease do.
Thanks
Comment #8
berdirI am a bit confused by the DrupalWebTestCase and DrupalWebTestCaseCore classes, both seem to contain the same setUp() functions.
I added the user_access reset to both for now. I also added two simple test functions for the user_access cache, the second one fails without the change in setUp().
Comment #9
boombatower commentedThe DrupalWebTestCaseCore is a direct copy from Drupal 7.x. The DrupalWebTestCase overrides the methods that require changing for Drupal 6. So only need to add it to the DrupalWebTestCase.
Comment #10
berdirUpdated patch, removed change of core class.
Comment #11
boombatower commentedCommitted.
Thanks.