Annotation of embedaddon/php/ext/mbstring/tests/mb_strtoupper_error1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test mb_strtoupper() function : error conditions - pass incorrect number of args
! 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: * Pass an incorrect number of arguments to mb_strtoupper() to test behaviour
! 17: */
! 18:
! 19: echo "*** Testing mb_strtoupper() : error conditions ***\n";
! 20:
! 21: //Test mb_strtoupper with one more than the expected number of arguments
! 22: echo "\n-- Testing mb_strtoupper() function with more than expected no. of arguments --\n";
! 23: $sourcestring = 'string_value';
! 24: $encoding = 'UTF-8';
! 25: $extra_arg = 10;
! 26: var_dump( mb_strtoupper($sourcestring, $encoding, $extra_arg) );
! 27:
! 28: //Test mb_strtoupper with zero arguments
! 29: echo "\n-- Testing mb_strtoupper() function with zero arguments --\n";
! 30: var_dump( mb_strtoupper() );
! 31:
! 32: echo "Done";
! 33: ?>
! 34:
! 35: --EXPECTF--
! 36: *** Testing mb_strtoupper() : error conditions ***
! 37:
! 38: -- Testing mb_strtoupper() function with more than expected no. of arguments --
! 39:
! 40: Warning: mb_strtoupper() expects at most 2 parameters, 3 given in %s on line %d
! 41: NULL
! 42:
! 43: -- Testing mb_strtoupper() function with zero arguments --
! 44:
! 45: Warning: mb_strtoupper() expects at least 1 parameter, 0 given in %s on line %d
! 46: NULL
! 47: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>