Modernise checks for PHP NULL and resources
This commit is contained in:
parent
12bcd36923
commit
a51a5c77f2
1 changed files with 2 additions and 14 deletions
|
|
@ -209,23 +209,11 @@ class check {
|
||||||
}
|
}
|
||||||
|
|
||||||
static function resource($a,$b,$message) {
|
static function resource($a,$b,$message) {
|
||||||
$resource=trim(check::var_dump($a));
|
return check::equal(get_resource_type($a), $b, $message);
|
||||||
if (! preg_match("/^resource\([0-9]+\) of type \($b\)/i", $resource))
|
|
||||||
return check::fail($message);
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static function isnull($a,$message) {
|
static function isnull($a,$message) {
|
||||||
$value=trim(check::var_dump($a));
|
return check::equal($a,NULL,$message);
|
||||||
return check::equal($value,"NULL",$message);
|
|
||||||
}
|
|
||||||
|
|
||||||
static function var_dump($arg) {
|
|
||||||
ob_start();
|
|
||||||
var_dump($arg);
|
|
||||||
$result=ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static function fail($pattern) {
|
static function fail($pattern) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue