Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A Test Suite for SimpleTest 1.0.0 and 'exit status'
<?php
class AllTests extends GroupTest {
function AllTests() {
$this->add( realpath('.') );
}
function add( $dir = null ) {
if ( $dh = opendir( $dir ) ) {
while ( ($e = readdir( $dh )) !== false ) {
$path = $dir.DIRECTORY_SEPARATOR.$e;
if ( is_dir( $path ) and !preg_match( '/\A\./', $e ) ) {
$this->add( $path );
} else if ( preg_match( '/\Atest_.*\.php\z/', $e ) ) {
$this->addTestFile( $path );
}
}
closedir( $dh );
}
}
}
if ( realpath( $_SERVER['SCRIPT_FILENAME'] ) == __FILE__ ) {
$test = &new AllTests();
$reporter = null;
if ( SimpleReporter::inCli() ) {
$reporter =& new TextReporter();
} else {
$reporter = &new HtmlReporter();
}
exit( $test->run( $reporter ) ? 0 : 1 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment