Annotation of embedaddon/php/ext/standard/tests/strings/nl_langinfo_variation1.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test nl_langinfo() function : unexpected inputs for '$tem' argument
3: --SKIPIF--
4: <?php
5: if( substr(PHP_OS, 0, 3) == 'WIN'){
6: die('skip Not for Windows');
7: }
8: ?>
9: --FILE--
10: <?php
11:
12: /* Prototype : string nl_langinfo ( int $item )
13: * Description: Query language and locale information
14: * Source code: ext/standard/string.c
15: */
16:
17: echo "*** Testing nl_langinfo() : with unexpected inputs for 'item' argument ***\n";
18:
19: $original = setlocale(LC_ALL, 'C');
20:
21: //get an unset variable
22: $unset_var = 'string_val';
23: unset($unset_var);
24:
25: //defining a class
26: class sample {
27: public function __toString() {
28: return "sample object";
29: }
30: }
31:
32: //getting the resource
33: $file_handle = fopen(__FILE__, "r");
34:
35: // array with different values for $input
36: $items = array (
37: // integer values
1.1.1.2 ! misho 38: /*1*/ 2147483647,
1.1 misho 39: -2147483648,
1.1.1.2 ! misho 40: -20,
1.1 misho 41:
1.1.1.2 ! misho 42: // array values
! 43: /*4*/ array(),
1.1 misho 44: array(0),
45: array(1, 2),
46:
47: // objects
1.1.1.2 ! misho 48: /*7*/ new sample(),
1.1 misho 49:
50: // resource
1.1.1.2 ! misho 51: /*8*/ $file_handle,
! 52: );
1.1 misho 53:
54: //defining '$input' argument
55: $input = "Test string";
56:
57: // loop through with each element of the $items array to test nl_langinfo() function
58: $count = 1;
59: foreach($items as $item) {
60: echo "-- Iteration $count --\n";
61: var_dump( nl_langinfo($item) );
62: $count ++;
63: }
64:
65: fclose($file_handle); //closing the file handle
66: setlocale(LC_ALL, $original);
67:
68: ?>
69: ===DONE===
70: --EXPECTF--
71: *** Testing nl_langinfo() : with unexpected inputs for 'item' argument ***
72: -- Iteration 1 --
73:
74: Warning: nl_langinfo(): Item '2147483647' is not valid in %s on line %d
75: bool(false)
1.1.1.2 ! misho 76: -- Iteration 2 --
1.1 misho 77:
78: Warning: nl_langinfo(): Item '-2147483648' is not valid in %s on line %d
79: bool(false)
1.1.1.2 ! misho 80: -- Iteration 3 --
1.1 misho 81:
82: Warning: nl_langinfo(): Item '-20' is not valid in %s on line %d
83: bool(false)
1.1.1.2 ! misho 84: -- Iteration 4 --
1.1 misho 85:
86: Warning: nl_langinfo() expects parameter 1 to be long, array given in %s on line %d
87: NULL
1.1.1.2 ! misho 88: -- Iteration 5 --
1.1 misho 89:
90: Warning: nl_langinfo() expects parameter 1 to be long, array given in %s on line %d
91: NULL
1.1.1.2 ! misho 92: -- Iteration 6 --
1.1 misho 93:
94: Warning: nl_langinfo() expects parameter 1 to be long, array given in %s on line %d
95: NULL
1.1.1.2 ! misho 96: -- Iteration 7 --
1.1 misho 97:
98: Warning: nl_langinfo() expects parameter 1 to be long, object given in %s on line %d
99: NULL
1.1.1.2 ! misho 100: -- Iteration 8 --
1.1 misho 101:
102: Warning: nl_langinfo() expects parameter 1 to be long, resource given in %s on line %d
103: NULL
104: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>