Annotation of embedaddon/php/ext/mbstring/tests/mb_strtolower_variation3.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test mb_strtolower() function : usage variations - pass mixed ASCII and non-ASCII strings
        !             3: --SKIPIF--
        !             4: <?php
        !             5: extension_loaded('mbstring') or die('skip');
        !             6: function_exists('mb_strtolower') or die("skip mb_strtolower() is not available in this build");
        !             7: ?>
        !             8: --FILE--
        !             9: <?php
        !            10: /* Prototype  : string mb_strtolower(string $sourcestring [, string $encoding])
        !            11:  * Description: Returns a lowercased version of $sourcestring
        !            12:  * Source code: ext/mbstring/mbstring.c
        !            13:  */
        !            14: 
        !            15: /*
        !            16:  * Pass a Japanese string and a mixed Japanese and ASCII string to mb_strtolower
        !            17:  * to check correct conversion is occuring (Japanese characters should not be converted).
        !            18:  */
        !            19: 
        !            20: echo "*** Testing mb_strtolower() : usage variations ***\n";
        !            21: 
        !            22: $string_mixed = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCUEhQLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==');
        !            23: $string_mixed_lower = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCcGhwLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==');
        !            24: $string_all_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC');
        !            25: 
        !            26: echo "\n-- Mixed string (mulitbyte and ASCII characters) --\n";
        !            27: $a = mb_strtolower($string_mixed, 'UTF-8');
        !            28: var_dump(base64_encode($a));
        !            29: if ($a == $string_mixed_lower) {
        !            30:        echo "Correctly Converted\n";
        !            31: } else {
        !            32:        echo "Incorrectly Converted\n";
        !            33: }
        !            34: 
        !            35: echo "\n-- Multibyte Only String--\n";
        !            36: $b = mb_strtolower($string_all_mb, 'UTF-8');
        !            37: var_dump(base64_encode($b));
        !            38: if ($b == $string_all_mb) { // Japanese characters only - should not be any conversion
        !            39:        echo "Correctly Converted\n";
        !            40: } else {
        !            41:        echo "Incorrectly Converted\n";
        !            42: }
        !            43: 
        !            44: echo "Done";
        !            45: ?>
        !            46: 
        !            47: --EXPECTF--
        !            48: *** Testing mb_strtolower() : usage variations ***
        !            49: 
        !            50: -- Mixed string (mulitbyte and ASCII characters) --
        !            51: string(80) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCcGhwLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg=="
        !            52: Correctly Converted
        !            53: 
        !            54: -- Multibyte Only String--
        !            55: string(40) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC"
        !            56: Correctly Converted
        !            57: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>