Annotation of embedaddon/php/ext/filter/tests/014.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: filter_var() and FILTER_VALIDATE_BOOLEAN
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("filter")) die("skip"); ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: class test {
! 9:
! 10: function __toString() {
! 11: return "blah";
! 12: }
! 13: }
! 14:
! 15: $t = new test;
! 16:
! 17: var_dump(filter_var("no", FILTER_VALIDATE_BOOLEAN));
! 18: var_dump(filter_var(NULL, FILTER_VALIDATE_BOOLEAN));
! 19: var_dump(filter_var($t, FILTER_VALIDATE_BOOLEAN));
! 20: var_dump(filter_var(array(1,2,3,0,array("", "123")), FILTER_VALIDATE_BOOLEAN, FILTER_REQUIRE_ARRAY));
! 21: var_dump(filter_var("yes", FILTER_VALIDATE_BOOLEAN));
! 22: var_dump(filter_var("true", FILTER_VALIDATE_BOOLEAN));
! 23: var_dump(filter_var("false", FILTER_VALIDATE_BOOLEAN));
! 24: var_dump(filter_var("off", FILTER_VALIDATE_BOOLEAN));
! 25: var_dump(filter_var("on", FILTER_VALIDATE_BOOLEAN));
! 26: var_dump(filter_var("0", FILTER_VALIDATE_BOOLEAN));
! 27: var_dump(filter_var("1", FILTER_VALIDATE_BOOLEAN));
! 28: var_dump(filter_var("NONE", FILTER_VALIDATE_BOOLEAN));
! 29: var_dump(filter_var("", FILTER_VALIDATE_BOOLEAN));
! 30: var_dump(filter_var(-1, FILTER_VALIDATE_BOOLEAN));
! 31: var_dump(filter_var("000000", FILTER_VALIDATE_BOOLEAN));
! 32: var_dump(filter_var("111111", FILTER_VALIDATE_BOOLEAN));
! 33:
! 34:
! 35: echo "Done\n";
! 36: ?>
! 37: --EXPECT--
! 38: bool(false)
! 39: bool(false)
! 40: bool(false)
! 41: array(5) {
! 42: [0]=>
! 43: bool(true)
! 44: [1]=>
! 45: bool(false)
! 46: [2]=>
! 47: bool(false)
! 48: [3]=>
! 49: bool(false)
! 50: [4]=>
! 51: array(2) {
! 52: [0]=>
! 53: bool(false)
! 54: [1]=>
! 55: bool(false)
! 56: }
! 57: }
! 58: bool(true)
! 59: bool(true)
! 60: bool(false)
! 61: bool(false)
! 62: bool(true)
! 63: bool(false)
! 64: bool(true)
! 65: bool(false)
! 66: bool(false)
! 67: bool(false)
! 68: bool(false)
! 69: bool(false)
! 70: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>