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

1.1     ! misho       1: --TEST--
        !             2: Test mb_strtolower() function : usage variations - pass different characters to check conversion is correct
        !             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 accented characters and Russian characters to check case conversion is correct
        !            17:  */
        !            18: 
        !            19: echo "*** Testing mb_strtolower() :  usage variations ***\n";
        !            20: 
        !            21: $uppers = array('Basic Latin' => b'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 
        !            22:                 'Characters With Accents' => base64_decode('w4DDgcOCw4PDhMOFw4bDh8OIw4nDisOLw4zDjcOOw4/DkMORw5LDk8OUw5XDlg=='),
        !            23:                 'Russian' => base64_decode('0JDQkdCS0JPQlNCV0JbQlw=='));
        !            24: $lowers = array('Basic Latin' => b'abcdefghijklmnopqrstuvwxyz',
        !            25:                 'Characters With Accents' => base64_decode('w6DDocOiw6PDpMOlw6bDp8Oow6nDqsOrw6zDrcOuw6/DsMOxw7LDs8O0w7XDtg=='),
        !            26:                 'Russian' => base64_decode('0LDQsdCy0LPQtNC10LbQtw=='));
        !            27: 
        !            28: foreach ($uppers as $lang => $sourcestring) {
        !            29:        echo "\n-- $lang --\n";
        !            30:        $a = mb_strtolower($sourcestring, 'utf-8');
        !            31:        var_dump(base64_encode($a));
        !            32:        if ($a == $lowers[$lang]) {
        !            33:                echo "Correctly Converted\n";
        !            34:        } else {
        !            35:                echo "Incorrectly Converted\n";
        !            36:        }
        !            37: }
        !            38: 
        !            39: echo "Done";
        !            40: ?>
        !            41: 
        !            42: --EXPECTF--
        !            43: *** Testing mb_strtolower() :  usage variations ***
        !            44: 
        !            45: -- Basic Latin --
        !            46: string(36) "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo="
        !            47: Correctly Converted
        !            48: 
        !            49: -- Characters With Accents --
        !            50: string(64) "w6DDocOiw6PDpMOlw6bDp8Oow6nDqsOrw6zDrcOuw6/DsMOxw7LDs8O0w7XDtg=="
        !            51: Correctly Converted
        !            52: 
        !            53: -- Russian --
        !            54: string(24) "0LDQsdCy0LPQtNC10LbQtw=="
        !            55: Correctly Converted
        !            56: Done

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