What class create DrupalWebTestCase or DrupalTestCase?
Amitaibu - July 19, 2008 - 15:01
| Project: | SimpleTest |
| Version: | 6.x-1.x-dev |
| Component: | Documentation |
| Category: | support request |
| Priority: | normal |
| Assigned: | boombatower |
| Status: | closed |
Jump to:
Description
When I extended DrupalWebTestCase I saw $this->drupalVariableSet didn't work. Only when extended DrupalTestCase it worked . Doesn't extend DrupalTestCase?

#1
This is not documented clearly at all and should be fixed, but DrupalWebTestCase allows you to write tests in the 7.x format (as SimpleTest is in core). DrupalTestCase is compatible with 5.x tests.
#2
I bounced into the same problem today. dmitrig01 told me that I should use variable_set instead, at least in the -dev version of SimpleTest (not the 1.1 release). It'll still get reset to the original value afterwards because in -dev, tests are ran in a separate instance of Drupal.
He didn't mention the 7.x vs 5.x thing though. So this means we should/could always write tests using DrupalWebTestCase?
#3
DrupalWebTestCase is the future. It will be the only option in 7.x. We are providing both in 6.x to help with transition, but the 6.x version is not fully up to date with 7.x HEAD since that changes constantly. #274542: Back-port the batch API patch & related imporvements
The 7.x style (DrupalWebTestCase) creates separate environments (copy of db and files directory) for the tests to run in. So once the test has completed the separate environment is simply destroyed.
Since this is not clear at all for anyone not involved in the testing stuff I will try and get some documentation of this and link to it on the SimpleTest project page.
#4
boombatower: thanks! I've collected a couple more undocumented facts while I've been writing tests. I'll post them tomorrow so you can decide what to do with them :)
#5
Working on documentation tonight, but now use #274542: Back-port the batch API patch & related imporvements for all 7.x style development.
#6
Automatically closed -- issue fixed for two weeks with no activity.