Annotation of embedaddon/php/ext/standard/tests/strings/setlocale_error.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test setlocale() function : error condition
3: --INI--
4: error_reporting=14335
5: --SKIPIF--
6: <?php
7: if (substr(PHP_OS, 0, 3) == 'WIN') {
8: die('skip Not valid for windows');
9: }
10: ?>
11: --FILE--
12: <?php
13: /* Prototype : string setlocale (int $category , string $locale [,string $..] )
14: : string setlocale(int $category , array $locale);
1.1.1.2 ! misho 15: * Description: Sets locale information.Returns the new current locale , or FALSE if locale functionality is not implemented in this platform.
1.1 misho 16: * Source code: ext/standard/string.c
17: */
18:
19: echo "*** Testing setlocale() : error conditions ***\n";
20:
21: // Zero argument
22: echo "\n-- Testing setlocale() function with Zero arguments --";
23: var_dump( setlocale());
24:
25: // One argument
26: echo "\n-- Testing setlocale() function with One argument, 'category' = LC_ALL --";
27: var_dump( setlocale(LC_ALL) );
28:
29: echo "\n-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --\n";
30: //Invalid array of locales
31: $invalid_locales = array("en_US.invalid", "en_AU.invalid", "ko_KR.invalid");
32: var_dump( setlocale(LC_ALL,$invalid_locales) );
33:
34: echo "\n-- Testing setlocale() function with invalid multiple locales, 'category' = LC_ALL --\n";
35: //Invalid array of locales
36: var_dump( setlocale(LC_ALL,"en_US.invalid", "en_AU.invalid", "ko_KR.invalid") );
37:
38: echo "\n-- Testing setlocale() function with invalid category --\n";
39: //invalid $category
40: $invalid_category = "TEST";
41: var_dump( setlocale($invalid_category,"en_US.utf8") );
42:
43: echo "\nDone";
44: ?>
45: --EXPECTF--
46: *** Testing setlocale() : error conditions ***
47:
48: -- Testing setlocale() function with Zero arguments --
49: Warning: setlocale() expects at least 2 parameters, 0 given in %s on line %d
50: NULL
51:
52: -- Testing setlocale() function with One argument, 'category' = LC_ALL --
53: Warning: setlocale() expects at least 2 parameters, 1 given in %s on line %d
54: NULL
55:
56: -- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --
57: bool(false)
58:
59: -- Testing setlocale() function with invalid multiple locales, 'category' = LC_ALL --
60: bool(false)
61:
62: -- Testing setlocale() function with invalid category --
63:
64: Deprecated: setlocale(): Passing locale category name as string is deprecated. Use the LC_* -constants instead in %s on line %d
65:
66: Warning: setlocale(): Invalid locale category name TEST, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME in %s on line %d
67: bool(false)
68:
69: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>