Annotation of embedaddon/php/ext/mbstring/tests/mb_substr_count_error2.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test mb_substr_count() function : error conditions - pass unknown encoding
                      3: --SKIPIF--
                      4: <?php
                      5: extension_loaded('mbstring') or die('skip');
                      6: function_exists('mb_substr_count') or die("skip mb_substr_count() is not available in this build");
                      7: ?>
                      8: --FILE--
                      9: <?php
                     10: /* Prototype  : int mb_substr_count(string $haystack, string $needle [, string $encoding])
                     11:  * Description: Count the number of substring occurrences 
                     12:  * Source code: ext/mbstring/mbstring.c
                     13:  */
                     14: 
                     15: /*
                     16:  * Test behaviour of mb_substr_count() function when passed an unknown encoding
                     17:  */
                     18: 
                     19: echo "*** Testing mb_substr_count() : error conditions ***\n";
                     20: 
                     21: $haystack = 'Hello, World!';
                     22: $needle = 'Hello';
                     23: $encoding = 'unknown-encoding';
                     24: 
                     25: echo "\n-- Testing mb_substr_count() function with an unknown encoding --\n";
                     26: var_dump(mb_substr_count($haystack, $needle, $encoding));
                     27: 
                     28: echo "Done";
                     29: ?>
                     30: --EXPECTF--
                     31: *** Testing mb_substr_count() : error conditions ***
                     32: 
                     33: -- Testing mb_substr_count() function with an unknown encoding --
                     34: 
                     35: Warning: mb_substr_count(): Unknown encoding "unknown-encoding" in %s on line %d
                     36: bool(false)
                     37: Done

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