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