Annotation of embedaddon/php/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test is_subclass_of() function : usage variations - unexpected type for arg 1
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : proto bool is_subclass_of(object object, string class_name)
! 6: * Description: Returns true if the object has this class as one of its parents
! 7: * Source code: Zend/zend_builtin_functions.c
! 8: * Alias to functions:
! 9: */
! 10: // Note: basic use cases in Zend/tests/is_a.phpt
! 11: function __autoload($className) {
! 12: echo "In __autoload($className)\n";
! 13: }
! 14:
! 15: function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
! 16: echo "Error: $err_no - $err_msg, $filename($linenum)\n";
! 17: }
! 18: set_error_handler('test_error_handler');
! 19:
! 20:
! 21: echo "*** Testing is_subclass_of() : usage variations ***\n";
! 22:
! 23: // Initialise function arguments not being substituted (if any)
! 24: $class_name = 'string_val';
! 25:
! 26: //get an unset variable
! 27: $unset_var = 10;
! 28: unset ($unset_var);
! 29:
! 30: //array of values to iterate over
! 31: $values = array(
! 32:
! 33: // int data
! 34: 0,
! 35: 1,
! 36: 12345,
! 37: -2345,
! 38:
! 39: // float data
! 40: 10.5,
! 41: -10.5,
! 42: 10.1234567e10,
! 43: 10.7654321E-10,
! 44: .5,
! 45:
! 46: // array data
! 47: array(),
! 48: array(0),
! 49: array(1),
! 50: array(1, 2),
! 51: array('color' => 'red', 'item' => 'pen'),
! 52:
! 53: // null data
! 54: NULL,
! 55: null,
! 56:
! 57: // boolean data
! 58: true,
! 59: false,
! 60: TRUE,
! 61: FALSE,
! 62:
! 63: // empty data
! 64: "",
! 65: '',
! 66:
! 67: // string data
! 68: "string",
! 69: 'String',
! 70:
! 71: // undefined data
! 72: $undefined_var,
! 73:
! 74: // unset data
! 75: $unset_var,
! 76: );
! 77:
! 78: // loop through each element of the array for object
! 79:
! 80: foreach($values as $value) {
! 81: echo "\nArg value $value \n";
! 82: var_dump( is_subclass_of($value, $class_name) );
! 83: };
! 84:
! 85: echo "Done";
! 86: ?>
! 87: --EXPECTF--
! 88: *** Testing is_subclass_of() : usage variations ***
! 89: Error: 8 - Undefined variable: undefined_var, %s(69)
! 90: Error: 8 - Undefined variable: unset_var, %s(72)
! 91:
! 92: Arg value 0
! 93: bool(false)
! 94:
! 95: Arg value 1
! 96: bool(false)
! 97:
! 98: Arg value 12345
! 99: bool(false)
! 100:
! 101: Arg value -2345
! 102: bool(false)
! 103:
! 104: Arg value 10.5
! 105: bool(false)
! 106:
! 107: Arg value -10.5
! 108: bool(false)
! 109:
! 110: Arg value 101234567000
! 111: bool(false)
! 112:
! 113: Arg value 1.07654321E-9
! 114: bool(false)
! 115:
! 116: Arg value 0.5
! 117: bool(false)
! 118:
! 119: Arg value Array
! 120: bool(false)
! 121:
! 122: Arg value Array
! 123: bool(false)
! 124:
! 125: Arg value Array
! 126: bool(false)
! 127:
! 128: Arg value Array
! 129: bool(false)
! 130:
! 131: Arg value Array
! 132: bool(false)
! 133:
! 134: Arg value
! 135: bool(false)
! 136:
! 137: Arg value
! 138: bool(false)
! 139:
! 140: Arg value 1
! 141: bool(false)
! 142:
! 143: Arg value
! 144: bool(false)
! 145:
! 146: Arg value 1
! 147: bool(false)
! 148:
! 149: Arg value
! 150: bool(false)
! 151:
! 152: Arg value
! 153: bool(false)
! 154:
! 155: Arg value
! 156: bool(false)
! 157:
! 158: Arg value string
! 159: In __autoload(string)
! 160: bool(false)
! 161:
! 162: Arg value String
! 163: In __autoload(String)
! 164: bool(false)
! 165:
! 166: Arg value
! 167: bool(false)
! 168:
! 169: Arg value
! 170: bool(false)
! 171: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>