I have two test files. When I launch simpletest, if the first test lasts less than 1s I get the following error:

PHP Fatal error: require_once() [function.require]: Failed opening required '' (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Users/matthieu/Sites/portal/sites/all/modules/simpletest/simpletest.module on line 211

The simpletest_test_get_all_classes() returns an empty array because all test files are already included.

This error occurs when two tests are performed by one call of batch with the same context. I found the condition in the batch.inc file line 214

if ($batch['progressive'] && timer_read('batch_processing') > 1000) {
break;
}

The solution I use temporarly is to test if the array returned by simpletest_test_get_all_classes() is empty (simpletest.module line 210):
$classes = simpletest_test_get_all_classes();
if (!empty($classes) {
require_once $classes[$test_class]['file'];
}

Comments

boombatower’s picture

Project: SimpleTest » Drupal core
Version: 6.x-2.9 » 7.x-dev
Component: Code » simpletest.module

Seems like this may effect core as well and should be fixed and backported.

svdoord’s picture

StatusFileSize
new771 bytes

I'm not involved in D7 development, but I just ran into this issue with D6 and simpletest module. I rolled a patch file based on the proposed fix above. Hoping that this will get the fix to be included in the D6 simpletest distribution, I'm uploading it here. Again, this is a patch for D6 version of simpletest module!

boombatower’s picture

Project: Drupal core » SimpleTest
Version: 7.x-dev » 6.x-2.x-dev
Component: simpletest.module » Code

Since Drupal 7.x autoloads classes this won't effect it.

boombatower’s picture

Status: Active » Fixed

Committed.

Status: Fixed » Closed (fixed)

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

svdoord’s picture

Ouch, just ran into this again on a different installation, forgot about it. Is the D6 version of Simpletest going to have another release? I'd really appreciate that...

naxoc’s picture

StatusFileSize
new618 bytes

Please ignore this patch. This is only needed for http://drupal.org/project/drupalorg_testing - I uploaded it here because it is pulled in from a makefile in that project and the patch needs a place to live that makes sense :)