In a test class, I have:
public function setUp() {
DrupalWebTestCase::setUp('search', 'search_by_page', 'sbp_attach', 'content', 'filefield', 'search_files', 'sbp_test', 'dblog');
The "content" (CCK) module is missing from this particular Drupal installation, as well as 'filefield'.
So this line, in my opinion, should cause a test failure (and hopefully an abort of the rest of the test) on that setup line with a message like "All required modules found".
But instead, the test continues all green/passed until farther down when some action actually tries to call a function that is in the content module, and then the entire set of tests I was running abort with a PHP error.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | testfail.png | 12.92 KB | jhodgdon |
Comments
Comment #1
jhodgdonComment #2
dave reidYou should be using the 'dependencies' in the getInfo() so the test won't even run if the module isn't found. For example:
Comment #3
jhodgdonAh, my mistake! Thanks for clearing that up. Must have missed that in the doc...
Comment #4
jhodgdonActually, I don't see that in the doc... I can add it (or someone else can), but for the moment I will change the component/status/title.
It seems like it should be mentioned on probably all of these pages:
http://drupal.org/node/395012
http://drupal.org/node/30010
http://drupal.org/node/325974
Comment #5
jhodgdonI apparently cannot spell today
Comment #6
jhodgdonUmmm... Does this dependency check work in 6.x?
I did this:
Then I removed the CCK module from this installation on my test box.
But the test was allowed to run, and only failed when it tried to call a function in the CCK module.
Comment #7
dave reidOh yes, I thought this was documented at some point, so thanks for pointing that out!
Comment #8
dave reid@jhodgdon Make sure your test file cache is cleared by using the 'Clean environment' button on the SimpleTest page.
Comment #9
jhodgdonHmmm...
I'm running SimpleTest 6.x-2.10 on Drupal 6.15.
I removed the cck directory from sites/all/modules, cleared all caches on the Performance tab, went to Modules list and refreshed (to verify Content is not listed in the CCK section of the modules list), went to Testing and clicked the "Clean environment" button a few times (until it came back clean).
Then tried to run my test, whose header is:
I got an error screen, and then when I clicked "go to the error page" I got the attached screen showing the error. The error is in filefield.install. From what you are saying, it looks like it should have errored out sooner or refused to run?
Comment #10
dave reidOh, 6.x-2.x SimpleTest is missing the dependency checking for test files. Needs to be backported from #343502: Allow tests to require and test existance of contrib modules.
Comment #11
jhodgdonOK then. I'll set this back to a bug in the code then.
Comment #12
boombatower commentedShould be fixed as requirement for #890440: Backport latest SimpleTest code from D7.
Comment #13
kenorb commentedBug related to #2 syntax:
#1781018: Simpletest dropping the real Drupal tables instead of simpletest tables