2 require_once 'PHPUnit.php';
4 class CtypeTest
extends PHPUnit_TestCase
{
7 function CtypeTest( $name ) {
8 $this->PHPUnit_TestCase( $name );
12 $cont = file_get_contents( '../includes/compatability/ctype.php' );
14 preg_match_all( '~function (ctype_[a-z]+)~', $cont, $m );
15 $this->populateFunctions( $m[1] );
17 // Will get called before each test* function
18 if ( function_exists( '_ctype_alnum' ) )
21 $cont = preg_replace( '~^<\?php~', '', $cont );
22 $cont = preg_replace( '~\?>$~', '', $cont );
24 // Rename the custom functions so they don't conflict
25 $cont = preg_replace( '~(function )(ctype_)~', '\1_\2', $cont );
31 function populateFunctions( $functions ) {
32 $this->functions
= array();
33 foreach ( $functions as $function )
34 $this->functions
[$function] = "_$function";
37 function tearDown() {}
39 // function testInteger256_to_big() {}
41 function testInteger0_to_255() {
42 foreach ( $this->functions
as $phpfunc => $mwfunc )
43 foreach ( range( 0, 255 ) as $i )
51 function testChr0_to_255() {
52 foreach ( $this->functions
as $phpfunc => $mwfunc )
53 foreach ( range( 0, 255 ) as $i ) {