Annotation of embedaddon/php/ext/mbstring/tests/mb_strtoupper_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test mb_strtoupper() function : basic functionality
! 3: --SKIPIF--
! 4: <?php
! 5: extension_loaded('mbstring') or die('skip');
! 6: function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available in this build");
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10: /* Prototype : string mb_strtoupper(string $sourcestring [, string $encoding]
! 11: * Description: Returns a uppercased version of $sourcestring
! 12: * Source code: ext/mbstring/mbstring.c
! 13: */
! 14:
! 15: /*
! 16: * Test basic functionality of mb_strtoupper
! 17: */
! 18:
! 19: echo "*** Testing mb_strtoupper() : basic functionality ***\n";
! 20:
! 21: mb_internal_encoding('utf-8');
! 22: $ascii_lower = b'abcdefghijklmnopqrstuvwxyz';
! 23: $ascii_upper = b'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
! 24: $greek_lower = base64_decode('zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J');
! 25: $greek_upper = base64_decode('zpHOks6TzpTOlc6WzpfOmM6ZzprOm86czp3Ons6fzqDOoc6jzqTOpc6mzqfOqM6p');
! 26:
! 27: echo "\n-- ASCII String --\n";
! 28: $ascii = mb_strtoupper($ascii_lower);
! 29: var_dump(base64_encode($ascii));
! 30:
! 31: if($ascii == $ascii_upper) {
! 32: echo "Correctly converted\n";
! 33: } else {
! 34: echo "Incorrectly converted\n";
! 35: }
! 36:
! 37: echo "\n-- Multibyte String --\n";
! 38: $mb = mb_strtoupper($greek_lower, 'UTF-8');
! 39: var_dump(base64_encode($mb));
! 40:
! 41: if ($mb == $greek_upper) {
! 42: echo "Correctly converted\n";
! 43: } else {
! 44: echo "Incorreclty converted\n";
! 45: }
! 46:
! 47: echo "Done";
! 48: ?>
! 49:
! 50: --EXPECT--
! 51: *** Testing mb_strtoupper() : basic functionality ***
! 52:
! 53: -- ASCII String --
! 54: string(36) "QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo="
! 55: Correctly converted
! 56:
! 57: -- Multibyte String --
! 58: string(64) "zpHOks6TzpTOlc6WzpfOmM6ZzprOm86czp3Ons6fzqDOoc6jzqTOpc6mzqfOqM6p"
! 59: Correctly converted
! 60: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>