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.

CommentFileSizeAuthor
#2 simpletest.module.overviewform.patch386 byteszoen

Comments

boombatower’s picture

Status: Active » Closed (won't fix)

SimpleTest 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.

zoen’s picture

StatusFileSize
new386 bytes

In 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.

boombatower’s picture

Status: Closed (won't fix) » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.