63ae05cff423c3f4f13a78d403a6a18d92966f4a
[m6w6/ext-http] / tests / skip.inc
1 <?php
2 defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w'));
3 if (!function_exists('fprintf')) {
4 function fprintf(){ $a=func_get_args(); $s=array_shift($a); return fwrite($s, call_user_func_array('sprintf',$a)); }
5 }
6 function skipif($if, $skip) { if ($if) { fprintf(STDOUT, "skip $skip"); exit(); }}
7 function checkcgi() { skipif(!strncasecmp('CLI', PHP_SAPI, 3), 'need CGI SAPI'); }
8 function checkext($ext) { skipif(!extension_loaded($ext), "need ext/$ext"); }
9 function checkmin($ver) { skipif(round($ver,1) > round((double) PHP_VERSION,1), sprintf("need PHP >= v%0.1f",$ver)); }
10 function checkmax($ver) { skipif(round($ver,1) < round((double) PHP_VERSION,1), sprintf("need PHP <= v%0.1f",$ver)); }
11 function checkurl($url) { skipif(!@fsockopen($url, 80), "$url not responsive"); }
12 function checkcls($cls) { skipif(!class_exists($cls), "need class $cls"); }
13 function checkver($ver) { checkmin($ver); }
14 checkext('http');
15 ?>