Filename cannot be empty if a test lasts less than 1s

msprunck - November 9, 2009 - 07:41
Project:SimpleTest
Version:6.x-2.9
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

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'];
}

 
 

Drupal is a registered trademark of Dries Buytaert.