Created
April 4, 2010 13:11
-
-
Save wtnabe/355387 to your computer and use it in GitHub Desktop.
A Test Suite for SimpleTest 1.0.0 and 'exit status'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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