Annotation of embedaddon/php/ext/xml/tests/xml_parser_set_option_variation2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test xml_parser_set_option() function : usage variations
! 3: --SKIPIF--
! 4: <?php
! 5: if (!extension_loaded("xml")) {
! 6: print "skip - XML extension not loaded";
! 7: }
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11: /* Prototype : proto int xml_parser_set_option(resource parser, int option, mixed value)
! 12: * Description: Set options in an XML parser
! 13: * Source code: ext/xml/xml.c
! 14: * Alias to functions:
! 15: */
! 16:
! 17: echo "*** Testing xml_parser_set_option() : usage variations ***\n";
! 18: error_reporting(E_ALL & ~E_NOTICE);
! 19:
! 20: class aClass {
! 21: function __toString() {
! 22: return "Some Ascii Data";
! 23: }
! 24: }
! 25: // Initialise function arguments not being substituted (if any)
! 26: $parser = xml_parser_create();
! 27:
! 28: //get an unset variable
! 29: $unset_var = 10;
! 30: unset ($unset_var);
! 31:
! 32: //array of values to iterate over
! 33: $values = array(
! 34:
! 35: // outside of range int data
! 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: // object data
! 72: new aClass(),
! 73:
! 74: // undefined data
! 75: $undefined_var,
! 76:
! 77: // unset data
! 78: $unset_var,
! 79: );
! 80:
! 81: // loop through each element of the array for option
! 82:
! 83: foreach($values as $value) {
! 84: echo "\nArg value $value \n";
! 85: var_dump( xml_parser_set_option($parser, $value, 1) );
! 86: };
! 87:
! 88: xml_parser_free($parser);
! 89: echo "Done";
! 90: ?>
! 91: --EXPECTF--
! 92: *** Testing xml_parser_set_option() : usage variations ***
! 93:
! 94: Arg value 12345
! 95:
! 96: Warning: xml_parser_set_option(): Unknown option in %s on line %d
! 97: bool(false)
! 98:
! 99: Arg value -2345
! 100:
! 101: Warning: xml_parser_set_option(): Unknown option in %s on line %d
! 102: bool(false)
! 103:
! 104: Arg value 10.5
! 105:
! 106: Warning: xml_parser_set_option(): Unknown option in %s on line %d
! 107: bool(false)
! 108:
! 109: Arg value -10.5
! 110:
! 111: Warning: xml_parser_set_option(): Unknown option in %s on line %d
! 112: bool(false)
! 113:
! 114: Arg value 101234567000
! 115:
! 116: Warning: xml_parser_set_option(): Unknown option in %s on line %d
! 117: bool(false)
! 118:
! 119: Arg value 1.07654321E-9
! 120:
! 121: Warning: xml_parser_set_option(): Unknown option in %s on line %d
! 122: bool(false)
! 123:
! 124: Arg value 0.5
! 125:
! 126: Warning: xml_parser_set_option(): Unknown option in %s on line %d
! 127: bool(false)
! 128:
! 129: Arg value Array
! 130:
! 131: Warning: xml_parser_set_option() expects parameter 2 to be long, array given in %s on line %d
! 132: NULL
! 133:
! 134: Arg value Array
! 135:
! 136: Warning: xml_parser_set_option() expects parameter 2 to be long, array given in %s on line %d
! 137: NULL
! 138:
! 139: Arg value Array
! 140:
! 141: Warning: xml_parser_set_option() expects parameter 2 to be long, array given in %s on line %d
! 142: NULL
! 143:
! 144: Arg value Array
! 145:
! 146: Warning: xml_parser_set_option() expects parameter 2 to be long, array given in %s on line %d
! 147: NULL
! 148:
! 149: Arg value Array
! 150:
! 151: Warning: xml_parser_set_option() expects parameter 2 to be long, array given in %s on line %d
! 152: NULL
! 153:
! 154: Arg value
! 155:
! 156: Warning: xml_parser_set_option(): Unknown option in %s on line %d
! 157: bool(false)
! 158:
! 159: Arg value
! 160:
! 161: Warning: xml_parser_set_option(): Unknown option in %s on line %d
! 162: bool(false)
! 163:
! 164: Arg value 1
! 165: bool(true)
! 166:
! 167: Arg value
! 168:
! 169: Warning: xml_parser_set_option(): Unknown option in %s on line %d
! 170: bool(false)
! 171:
! 172: Arg value 1
! 173: bool(true)
! 174:
! 175: Arg value
! 176:
! 177: Warning: xml_parser_set_option(): Unknown option in %s on line %d
! 178: bool(false)
! 179:
! 180: Arg value
! 181:
! 182: Warning: xml_parser_set_option() expects parameter 2 to be long, string given in %s on line %d
! 183: NULL
! 184:
! 185: Arg value
! 186:
! 187: Warning: xml_parser_set_option() expects parameter 2 to be long, string given in %s on line %d
! 188: NULL
! 189:
! 190: Arg value string
! 191:
! 192: Warning: xml_parser_set_option() expects parameter 2 to be long, string given in %s on line %d
! 193: NULL
! 194:
! 195: Arg value string
! 196:
! 197: Warning: xml_parser_set_option() expects parameter 2 to be long, string given in %s on line %d
! 198: NULL
! 199:
! 200: Arg value Some Ascii Data
! 201:
! 202: Warning: xml_parser_set_option() expects parameter 2 to be long, object given in %s on line %d
! 203: NULL
! 204:
! 205: Arg value
! 206:
! 207: Warning: xml_parser_set_option(): Unknown option in %s on line %d
! 208: bool(false)
! 209:
! 210: Arg value
! 211:
! 212: Warning: xml_parser_set_option(): Unknown option in %s on line %d
! 213: bool(false)
! 214: Done
! 215:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>