Annotation of embedaddon/php/ext/standard/tests/dir/rewinddir_variation1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test rewinddir() function : usage variations - different data types as $dir_handle arg
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : void rewinddir([resource $dir_handle])
! 6: * Description: Rewind dir_handle back to the start
! 7: * Source code: ext/standard/dir.c
! 8: * Alias to functions: rewind
! 9: */
! 10:
! 11: /*
! 12: * Pass different data types as $dir_handle argument to rewinddir() to test behaviour
! 13: */
! 14:
! 15: echo "*** Testing rewinddir() : usage variations ***\n";
! 16:
! 17: //get an unset variable
! 18: $unset_var = 10;
! 19: unset ($unset_var);
! 20:
! 21: // get a class
! 22: class classA
! 23: {
! 24: public function __toString() {
! 25: return "Class A object";
! 26: }
! 27: }
! 28:
! 29: // heredoc string
! 30: $heredoc = <<<EOT
! 31: hello world
! 32: EOT;
! 33:
! 34: // unexpected values to be passed to $dir_handle argument
! 35: $inputs = array(
! 36:
! 37: // int data
! 38: /*1*/ 0,
! 39: 1,
! 40: 12345,
! 41: -2345,
! 42:
! 43: // float data
! 44: /*5*/ 10.5,
! 45: -10.5,
! 46: 12.3456789000e10,
! 47: 12.3456789000E-10,
! 48: .5,
! 49:
! 50: // null data
! 51: /*10*/ NULL,
! 52: null,
! 53:
! 54: // boolean data
! 55: /*12*/ true,
! 56: false,
! 57: TRUE,
! 58: FALSE,
! 59:
! 60: // empty data
! 61: /*16*/ "",
! 62: '',
! 63: array(),
! 64:
! 65: // string data
! 66: /*19*/ "string",
! 67: 'string',
! 68: $heredoc,
! 69:
! 70: // object data
! 71: /*22*/ new classA(),
! 72:
! 73: // undefined data
! 74: /*23*/ @$undefined_var,
! 75:
! 76: // unset data
! 77: /*24*/ @$unset_var,
! 78: );
! 79:
! 80: // loop through each element of $inputs to check the behavior of rewinddir()
! 81: $iterator = 1;
! 82: foreach($inputs as $input) {
! 83: echo "\n-- Iteration $iterator --\n";
! 84: var_dump( rewinddir($input) );
! 85: $iterator++;
! 86: };
! 87: ?>
! 88: ===DONE===
! 89: --EXPECTF--
! 90: *** Testing rewinddir() : usage variations ***
! 91:
! 92: -- Iteration 1 --
! 93:
! 94: Warning: rewinddir() expects parameter 1 to be resource, integer given in %s on line %d
! 95: NULL
! 96:
! 97: -- Iteration 2 --
! 98:
! 99: Warning: rewinddir() expects parameter 1 to be resource, integer given in %s on line %d
! 100: NULL
! 101:
! 102: -- Iteration 3 --
! 103:
! 104: Warning: rewinddir() expects parameter 1 to be resource, integer given in %s on line %d
! 105: NULL
! 106:
! 107: -- Iteration 4 --
! 108:
! 109: Warning: rewinddir() expects parameter 1 to be resource, integer given in %s on line %d
! 110: NULL
! 111:
! 112: -- Iteration 5 --
! 113:
! 114: Warning: rewinddir() expects parameter 1 to be resource, double given in %s on line %d
! 115: NULL
! 116:
! 117: -- Iteration 6 --
! 118:
! 119: Warning: rewinddir() expects parameter 1 to be resource, double given in %s on line %d
! 120: NULL
! 121:
! 122: -- Iteration 7 --
! 123:
! 124: Warning: rewinddir() expects parameter 1 to be resource, double given in %s on line %d
! 125: NULL
! 126:
! 127: -- Iteration 8 --
! 128:
! 129: Warning: rewinddir() expects parameter 1 to be resource, double given in %s on line %d
! 130: NULL
! 131:
! 132: -- Iteration 9 --
! 133:
! 134: Warning: rewinddir() expects parameter 1 to be resource, double given in %s on line %d
! 135: NULL
! 136:
! 137: -- Iteration 10 --
! 138:
! 139: Warning: rewinddir() expects parameter 1 to be resource, null given in %s on line %d
! 140: NULL
! 141:
! 142: -- Iteration 11 --
! 143:
! 144: Warning: rewinddir() expects parameter 1 to be resource, null given in %s on line %d
! 145: NULL
! 146:
! 147: -- Iteration 12 --
! 148:
! 149: Warning: rewinddir() expects parameter 1 to be resource, boolean given in %s on line %d
! 150: NULL
! 151:
! 152: -- Iteration 13 --
! 153:
! 154: Warning: rewinddir() expects parameter 1 to be resource, boolean given in %s on line %d
! 155: NULL
! 156:
! 157: -- Iteration 14 --
! 158:
! 159: Warning: rewinddir() expects parameter 1 to be resource, boolean given in %s on line %d
! 160: NULL
! 161:
! 162: -- Iteration 15 --
! 163:
! 164: Warning: rewinddir() expects parameter 1 to be resource, boolean given in %s on line %d
! 165: NULL
! 166:
! 167: -- Iteration 16 --
! 168:
! 169: Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d
! 170: NULL
! 171:
! 172: -- Iteration 17 --
! 173:
! 174: Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d
! 175: NULL
! 176:
! 177: -- Iteration 18 --
! 178:
! 179: Warning: rewinddir() expects parameter 1 to be resource, array given in %s on line %d
! 180: NULL
! 181:
! 182: -- Iteration 19 --
! 183:
! 184: Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d
! 185: NULL
! 186:
! 187: -- Iteration 20 --
! 188:
! 189: Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d
! 190: NULL
! 191:
! 192: -- Iteration 21 --
! 193:
! 194: Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d
! 195: NULL
! 196:
! 197: -- Iteration 22 --
! 198:
! 199: Warning: rewinddir() expects parameter 1 to be resource, object given in %s on line %d
! 200: NULL
! 201:
! 202: -- Iteration 23 --
! 203:
! 204: Warning: rewinddir() expects parameter 1 to be resource, null given in %s on line %d
! 205: NULL
! 206:
! 207: -- Iteration 24 --
! 208:
! 209: Warning: rewinddir() expects parameter 1 to be resource, null given in %s on line %d
! 210: NULL
! 211: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>