While I was working on #560646: Fatal PHP errors don't cause tests to fail, in which SimpleTest seemed incapable of reporting fatal errors correctly, I turned to PIFR to see if I could detect the problem there. I wrote a patch that implements:
- Enumeration of tests based on parsing run-tests.sh --list. Results array is now created before run-tests.sh --all is invoked, and $this->results['data'] is pre-populated by --list.
- An additional operation called 'process', which handles stuff that get_results() used to handle. If some test classes have not returned results, an error is thrown here with a corresponding status of 'incomplete results/crash detected'.
- A new pre-built test called fail_fatal -- 'Fatal - Drupal 7, full suite, PHP Fatal Error in a test'
- Some other miscellaneous refactoring
While this patch correctly identifies test classes that store no assertions, it does not detect test methods, and therefore needs some work. That would involve having something like
run-tests.sh --list --verbose
return a full listing of classes and methods, so PIFR can count all the methods in the results.
Incidentally, this patch alerted me that TaxonomyTermUnitTest is currently useless:
/**
* Unit tests for taxonomy term functions.
*/
class TaxonomyTermUnitTest extends TaxonomyWebTestCase {
public static function getInfo() {
return array(
'name' => 'Taxonomy term unit tests',
'description' => 'Unit tests for taxonomy term functions.',
'group' => 'Taxonomy',
);
}
}
Since SimpleTest was fixed to insert the fail record rather than PIFR, I am posting this patch for curiosity and in the spirit of free software :)
| Comment | File | Size | Author |
|---|---|---|---|
| PIFR-detect-incomplete-results.patch | 16.36 KB | carlos8f |