Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
simpletest.module
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
21 May 2008 at 01:18 UTC
Updated:
11 Jun 2008 at 14:14 UTC
Jump to comment: Most recent file
Several tests change variables through page requests (ie. drupalGet, drupalPost), but the changes aren't picked up in the testing thread. This requires the test to manually reload variables, which is cumbersome and not obvious.
The variables should be reloaded automatically after page requests and setUp (new database).
If we decide that this is a good idea I will create a patch to clean up the tests based on this.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | simpletest_refresh.patch | 7.79 KB | boombatower |
| simpletest_refresh.patch | 2.25 KB | boombatower |
Comments
Comment #1
boombatower commentedDo we want to take this one set further and refresh menus, cache, etc? Less common, but might happen.
Also need to consider performance loss.
Comment #2
dries commentedboombatower, do you have an example scenario that helps me understand the need for this. I can 'sense' a need for it, but I'd like to back it up with a real data point. If you could help with that, that would be great.
Comment #3
boombatower commentedAn example of this issue is in the dblog test.
The call to reloadVariables in necessary since a variable was changed in the previous drupalPost call, but isn't picked up since that call was processed in a different PHP thread. Reload variables then reads the values out of the database to ensure that changes are picked up.
Comment #4
boombatower commentedAs a note this was found in this issue: http://drupal.org/node/241467, but was part of the list that was ignored after SimpleTest got into core. :)
Comment #5
dries commentedOK, I understand now. It wasn't obvious from the PHPdoc -- it could be more explanatory, IMO.
Secondly, I think this patch should also clean up existing 'variables reload' code, such as the one in the example you quotes.
If you can reroll the patch with slightly more verbose information, and some clean-up code, I'll commit it right away.
Keep up the good work!
Comment #6
boombatower commentedTests cleaned, documentation enhanced, and cleaned up setUp and tearDown methods.
Comment #7
dries commentedCommitted to CVS HEAD. Thanks for improving the documentation. Much appreciated.
Comment #8
dries commentedCommitted to CVS HEAD. Thanks boombatower.
Comment #9
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.