I added a simpletest to my custom module, but found that it didn't show up on the Simpletest overview form (/admin/build/simpletest). So I dug into the code of function simpletest_overview_form() to see where my test got lost. Oddly, I found that my test was present in the $output array at the very end of function simpletest_overview_form(). Simpletest had detected my test quite happily; it just hadn't been printed out in the form for some reason.
My test was the first in the $output array (it was $output[0]), perhaps because my custom module has the lowest weight in the system table. Out of curiosity, I tried adding a blank item to the start of the $output array at the beginning of simpletest_overview_form().
So where it says this:
function simpletest_overview_form() {
$output = array();
...
I changed it to this:
function simpletest_overview_form() {
$output = array();
$output[] = array();
...
Lo and behold, it worked - once I did that, my test showed up in the form, and I was able to select it and successfully run my test.
I'm pretty sure there's a bug in Simpletest 5.x which causes the first test group to be omitted from the form.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | simpletest.module.overviewform.patch | 386 bytes | zoen |
Comments
Comment #1
boombatower commentedSimpleTest 5.x is no longer developed and is very outdated. If you provide a patch I will go ahead and commit, but otherwise no one works on 5.x.
Comment #2
zoen commentedIn that case, I won't bother making my fix any more elegant :-) Here's the patch. As described, it adds a single line in function simpletest_overview_form(), which prevents the first module in line from being omitted from the form.
Comment #3
boombatower commentedCommitted, thanks.