File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
strings /
convert_cyr_string_error.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:04 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
Test convert_cyr_string() function : error conditions
--FILE--
<?php
/* Prototype : string convert_cyr_string ( string $str , string $from , string $to )
* Description: Convert from one Cyrillic character set to another
* Source code: ext/standard/string.c
*/
$str = "hello";
$from = "k";
$to = "d";
$extra_arg = 10;
echo "*** Testing convert_cyr_string() : error conditions ***\n";
echo "\n-- Testing convert_cyr_string() function with no arguments --\n";
var_dump( convert_cyr_string() );
echo "\n-- Testing convert_cyr_string() function with no 'to' character set --\n";
var_dump( convert_cyr_string($str, $from) );
echo "\n-- Testing convert_cyr_string() function with more than expected no. of arguments --\n";
var_dump( convert_cyr_string($str, $from, $to, $extra_arg) );
echo "\n-- Testing convert_cyr_string() function with invalid 'from' character set --\n";
var_dump(bin2hex( convert_cyr_string($str, "?", $to) ));
echo "\n-- Testing convert_cyr_string() function with invalid 'to' character set --\n";
var_dump(bin2hex( convert_cyr_string($str, $from, "?")) );
echo "\n-- Testing convert_cyr_string() function with invalid 'from' and 'to' character set --\n";
var_dump(bin2hex( convert_cyr_string($str, ">", "?")) );
?>
===DONE===
--EXPECTF--
*** Testing convert_cyr_string() : error conditions ***
-- Testing convert_cyr_string() function with no arguments --
Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d
NULL
-- Testing convert_cyr_string() function with no 'to' character set --
Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d
NULL
-- Testing convert_cyr_string() function with more than expected no. of arguments --
Warning: convert_cyr_string() expects exactly 3 parameters, 4 given in %s on line %d
NULL
-- Testing convert_cyr_string() function with invalid 'from' character set --
Warning: convert_cyr_string(): Unknown source charset: ? in %s on line %d
string(10) "68656c6c6f"
-- Testing convert_cyr_string() function with invalid 'to' character set --
Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d
string(10) "68656c6c6f"
-- Testing convert_cyr_string() function with invalid 'from' and 'to' character set --
Warning: convert_cyr_string(): Unknown source charset: > in %s on line %d
Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d
string(10) "68656c6c6f"
===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>