Annotation of embedaddon/php/ext/standard/tests/array/array_product_variation5.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test array_product() function : usage variation
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : mixed array_product(array input)
! 6: * Description: Returns the product of the array entries
! 7: * Source code: ext/standard/array.c
! 8: * Alias to functions:
! 9: */
! 10:
! 11: echo "*** Testing array_product() : usage variation ***\n";
! 12:
! 13: // Initialise function arguments not being substituted (if any)
! 14:
! 15: //get an unset variable
! 16: $unset_var = 10;
! 17: unset ($unset_var);
! 18:
! 19: // define some classes
! 20: class classWithToString
! 21: {
! 22: public function __toString() {
! 23: return "Class A object";
! 24: }
! 25: }
! 26:
! 27: class classWithoutToString
! 28: {
! 29: }
! 30:
! 31: // heredoc string
! 32: $heredoc = <<<EOT
! 33: hello world
! 34: EOT;
! 35:
! 36: // add arrays
! 37: $index_array = array (1, 2, 3);
! 38: $assoc_array = array ('one' => 1, 'two' => 2);
! 39:
! 40: //array of values to iterate over
! 41: $inputs = array(
! 42:
! 43: // int data
! 44: 'int 0' => 0,
! 45: 'int 1' => 1,
! 46: 'int 12345' => 12345,
! 47: 'int -12345' => -2345,
! 48:
! 49: // float data
! 50: 'float 10.5' => 10.5,
! 51: 'float -10.5' => -10.5,
! 52: 'float 12.3456789000e10' => 12.3456789000e10,
! 53: 'float -12.3456789000e10' => -12.3456789000e10,
! 54: 'float .5' => .5,
! 55:
! 56: // null data
! 57: 'uppercase NULL' => NULL,
! 58: 'lowercase null' => null,
! 59:
! 60: // boolean data
! 61: 'lowercase true' => true,
! 62: 'lowercase false' =>false,
! 63: 'uppercase TRUE' =>TRUE,
! 64: 'uppercase FALSE' =>FALSE,
! 65:
! 66: // empty data
! 67: 'empty string DQ' => "",
! 68: 'empty string SQ' => '',
! 69:
! 70: // string data
! 71: 'string DQ' => "string",
! 72: 'string SQ' => 'string',
! 73: 'mixed case string' => "sTrInG",
! 74: 'heredoc' => $heredoc,
! 75:
! 76: // object data
! 77: 'instance of classWithToString' => new classWithToString(),
! 78: 'instance of classWithoutToString' => new classWithoutToString(),
! 79:
! 80: // undefined data
! 81: 'undefined var' => @$undefined_var,
! 82:
! 83: // unset data
! 84: 'unset var' => @$unset_var,
! 85: );
! 86:
! 87: // loop through each element of the array for input
! 88:
! 89: foreach($inputs as $key =>$value) {
! 90: echo "\n--$key--\n";
! 91: var_dump( array_product($value) );
! 92: };
! 93:
! 94: ?>
! 95: ===DONE===
! 96: --EXPECTF--
! 97: *** Testing array_product() : usage variation ***
! 98:
! 99: --int 0--
! 100:
! 101: Warning: array_product() expects parameter 1 to be array, integer given in %sarray_product_variation5.php on line %d
! 102: NULL
! 103:
! 104: --int 1--
! 105:
! 106: Warning: array_product() expects parameter 1 to be array, integer given in %sarray_product_variation5.php on line %d
! 107: NULL
! 108:
! 109: --int 12345--
! 110:
! 111: Warning: array_product() expects parameter 1 to be array, integer given in %sarray_product_variation5.php on line %d
! 112: NULL
! 113:
! 114: --int -12345--
! 115:
! 116: Warning: array_product() expects parameter 1 to be array, integer given in %sarray_product_variation5.php on line %d
! 117: NULL
! 118:
! 119: --float 10.5--
! 120:
! 121: Warning: array_product() expects parameter 1 to be array, double given in %sarray_product_variation5.php on line %d
! 122: NULL
! 123:
! 124: --float -10.5--
! 125:
! 126: Warning: array_product() expects parameter 1 to be array, double given in %sarray_product_variation5.php on line %d
! 127: NULL
! 128:
! 129: --float 12.3456789000e10--
! 130:
! 131: Warning: array_product() expects parameter 1 to be array, double given in %sarray_product_variation5.php on line %d
! 132: NULL
! 133:
! 134: --float -12.3456789000e10--
! 135:
! 136: Warning: array_product() expects parameter 1 to be array, double given in %sarray_product_variation5.php on line %d
! 137: NULL
! 138:
! 139: --float .5--
! 140:
! 141: Warning: array_product() expects parameter 1 to be array, double given in %sarray_product_variation5.php on line %d
! 142: NULL
! 143:
! 144: --uppercase NULL--
! 145:
! 146: Warning: array_product() expects parameter 1 to be array, null given in %sarray_product_variation5.php on line %d
! 147: NULL
! 148:
! 149: --lowercase null--
! 150:
! 151: Warning: array_product() expects parameter 1 to be array, null given in %sarray_product_variation5.php on line %d
! 152: NULL
! 153:
! 154: --lowercase true--
! 155:
! 156: Warning: array_product() expects parameter 1 to be array, boolean given in %sarray_product_variation5.php on line %d
! 157: NULL
! 158:
! 159: --lowercase false--
! 160:
! 161: Warning: array_product() expects parameter 1 to be array, boolean given in %sarray_product_variation5.php on line %d
! 162: NULL
! 163:
! 164: --uppercase TRUE--
! 165:
! 166: Warning: array_product() expects parameter 1 to be array, boolean given in %sarray_product_variation5.php on line %d
! 167: NULL
! 168:
! 169: --uppercase FALSE--
! 170:
! 171: Warning: array_product() expects parameter 1 to be array, boolean given in %sarray_product_variation5.php on line %d
! 172: NULL
! 173:
! 174: --empty string DQ--
! 175:
! 176: Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d
! 177: NULL
! 178:
! 179: --empty string SQ--
! 180:
! 181: Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d
! 182: NULL
! 183:
! 184: --string DQ--
! 185:
! 186: Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d
! 187: NULL
! 188:
! 189: --string SQ--
! 190:
! 191: Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d
! 192: NULL
! 193:
! 194: --mixed case string--
! 195:
! 196: Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d
! 197: NULL
! 198:
! 199: --heredoc--
! 200:
! 201: Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d
! 202: NULL
! 203:
! 204: --instance of classWithToString--
! 205:
! 206: Warning: array_product() expects parameter 1 to be array, object given in %sarray_product_variation5.php on line %d
! 207: NULL
! 208:
! 209: --instance of classWithoutToString--
! 210:
! 211: Warning: array_product() expects parameter 1 to be array, object given in %sarray_product_variation5.php on line %d
! 212: NULL
! 213:
! 214: --undefined var--
! 215:
! 216: Warning: array_product() expects parameter 1 to be array, null given in %sarray_product_variation5.php on line %d
! 217: NULL
! 218:
! 219: --unset var--
! 220:
! 221: Warning: array_product() expects parameter 1 to be array, null given in %sarray_product_variation5.php on line %d
! 222: NULL
! 223: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>