+
+ $timeout = $leak_check ? 300 : (isset($env['TEST_TIMEOUT']) ? $env['TEST_TIMEOUT'] : 60);
I don't particularly like this semantic, as that way I can't set the timeout when using valgrind. A better way would be (IMHO):
$timeout = isset($env['TEST_TIMEOUT']) ? $env['TEST_TIMEOUT'] : ($leak_check ? 300 : 60);
Also, maybe it's time to put the timeout value computation outside of the function, otherwise that's two ifs for each test execution + skipif execution.
Anyway this seems a great addition, as now I can fine tune the timeout without editing the script by hand.
Nuno