1--TEST--
2iconv_get_encoding() parameter tests
3--CREDITS--
4Oystein Rose <orose@redpill-linpro.com>
5#PHPTestFest2009 Norway 2009-06-09 \o/
6--SKIPIF--
7<?php if (!extension_loaded("iconv")) { echo 'skip extension not available'; } ?>
8--FILE--
9<?php
10
11iconv_set_encoding("internal_encoding", "UTF-8");
12iconv_set_encoding("output_encoding",   "UTF-8");
13iconv_set_encoding("input_encoding",    "UTF-8");
14
15var_dump( iconv_get_encoding('internal_encoding') );
16var_dump( iconv_get_encoding('output_encoding')   );
17var_dump( iconv_get_encoding('input_encoding')    );
18var_dump( iconv_get_encoding('all')               );
19var_dump( iconv_get_encoding('foo')               );
20var_dump( iconv_get_encoding()                    );
21
22
23
24iconv_set_encoding("internal_encoding", "ISO-8859-1");
25iconv_set_encoding("output_encoding",   "ISO-8859-1");
26iconv_set_encoding("input_encoding",    "ISO-8859-1");
27
28var_dump( iconv_get_encoding('internal_encoding') );
29var_dump( iconv_get_encoding('output_encoding')   );
30var_dump( iconv_get_encoding('input_encoding')    );
31var_dump( iconv_get_encoding('all')               );
32var_dump( iconv_get_encoding('foo')               );
33var_dump( iconv_get_encoding()                    );
34
35?>
36--EXPECT--
37string(5) "UTF-8"
38string(5) "UTF-8"
39string(5) "UTF-8"
40array(3) {
41  ["input_encoding"]=>
42  string(5) "UTF-8"
43  ["output_encoding"]=>
44  string(5) "UTF-8"
45  ["internal_encoding"]=>
46  string(5) "UTF-8"
47}
48bool(false)
49array(3) {
50  ["input_encoding"]=>
51  string(5) "UTF-8"
52  ["output_encoding"]=>
53  string(5) "UTF-8"
54  ["internal_encoding"]=>
55  string(5) "UTF-8"
56}
57string(10) "ISO-8859-1"
58string(10) "ISO-8859-1"
59string(10) "ISO-8859-1"
60array(3) {
61  ["input_encoding"]=>
62  string(10) "ISO-8859-1"
63  ["output_encoding"]=>
64  string(10) "ISO-8859-1"
65  ["internal_encoding"]=>
66  string(10) "ISO-8859-1"
67}
68bool(false)
69array(3) {
70  ["input_encoding"]=>
71  string(10) "ISO-8859-1"
72  ["output_encoding"]=>
73  string(10) "ISO-8859-1"
74  ["internal_encoding"]=>
75  string(10) "ISO-8859-1"
76}
77