Annotation of embedaddon/php/ext/standard/tests/strings/substr_count_error.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test substr_count() function (error conditions)
                      3: --FILE--
                      4: <?php
                      5: 
                      6: echo "\n*** Testing error conditions ***\n";
                      7: /* Zero argument */
                      8: var_dump( substr_count() );
                      9: 
                     10: /* more than expected no. of args */
                     11: var_dump( substr_count($str, "t", 0, 15, 30) );
                     12:        
                     13: /* offset as negative value */
                     14: var_dump(substr_count($str, "t", -5));
                     15: 
                     16: /* offset > size of the string */
                     17: var_dump(substr_count($str, "t", 25));
                     18: 
                     19: /* Using offset and length to go beyond the size of the string: 
                     20:    Warning message expected, as length+offset > length of string */
                     21: var_dump( substr_count($str, "i", 5, 15) );
                     22: 
                     23: /* length as Null */
                     24: var_dump( substr_count($str, "t", "", "") );
                     25: var_dump( substr_count($str, "i", NULL, NULL) );
                     26:        
                     27: echo "Done\n"; 
                     28: 
                     29: ?>
                     30: --EXPECTF--
                     31: *** Testing error conditions ***
                     32: 
                     33: Warning: substr_count() expects at least 2 parameters, 0 given in %s on line %d
                     34: NULL
                     35: 
                     36: Notice: Undefined variable: str in %s on line %d
                     37: 
                     38: Warning: substr_count() expects at most 4 parameters, 5 given in %s on line %d
                     39: NULL
                     40: 
                     41: Notice: Undefined variable: str in %s on line %d
                     42: 
                     43: Warning: substr_count(): Offset should be greater than or equal to 0 in %s on line %d
                     44: bool(false)
                     45: 
                     46: Notice: Undefined variable: str in %s on line %d
                     47: 
                     48: Warning: substr_count(): Offset value 25 exceeds string length in %s on line %d
                     49: bool(false)
                     50: 
                     51: Notice: Undefined variable: str in %s on line %d
                     52: 
                     53: Warning: substr_count(): Offset value 5 exceeds string length in %s on line %d
                     54: bool(false)
                     55: 
                     56: Notice: Undefined variable: str in %s on line %d
                     57: 
                     58: Warning: substr_count() expects parameter 3 to be long, string given in %s on line %d
                     59: NULL
                     60: 
                     61: Notice: Undefined variable: str in %s on line %d
                     62: 
                     63: Warning: substr_count(): Length should be greater than 0 in %s on line %d
                     64: bool(false)
                     65: Done

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