Annotation of embedaddon/php/ext/standard/tests/time/strptime_error.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test localtime() function : error conditions
                      3: --SKIPIF--
                      4: <?php 
                      5: if (!function_exists('strptime')) {
                      6:        echo "SKIP strptime function not available in build";
                      7: }       
                      8: ?> 
                      9: --FILE--
                     10: <?php
                     11: /* Prototype  : array strptime  ( string $date  , string $format  )
                     12:  * Description: Parse a time/date generated with strftime()
                     13:  * Source code: ext/standard/datetime.c
                     14:  * Alias to functions: 
                     15:  */
                     16: 
                     17: //Set the default time zone 
                     18: date_default_timezone_set("Europe/London");
                     19: 
                     20: echo "*** Testing strptime() : error conditions ***\n";
                     21: 
                     22: echo "\n-- Testing strptime() function with Zero arguments --\n";
                     23: var_dump( strptime() );
                     24: 
                     25: echo "\n-- Testing strptime() function with less than expected no. of arguments --\n";
                     26: $format = '%b %d %Y %H:%M:%S';
                     27: $timestamp = mktime(8, 8, 8, 8, 8, 2008);
                     28: $date = strftime($format, $timestamp);
                     29: var_dump( strptime($date) );
                     30: 
                     31: echo "\n-- Testing strptime() function with more than expected no. of arguments --\n";
                     32: $extra_arg = 10;
                     33: var_dump( strptime($date, $format, $extra_arg) );
                     34: 
                     35: ?>
                     36: ===DONE===
                     37: --EXPECTF--
                     38: *** Testing strptime() : error conditions ***
                     39: 
                     40: -- Testing strptime() function with Zero arguments --
                     41: 
                     42: Warning: strptime() expects exactly 2 parameters, 0 given in %s on line %d
                     43: NULL
                     44: 
                     45: -- Testing strptime() function with less than expected no. of arguments --
                     46: 
                     47: Warning: strptime() expects exactly 2 parameters, 1 given in %s on line %d
                     48: NULL
                     49: 
                     50: -- Testing strptime() function with more than expected no. of arguments --
                     51: 
                     52: Warning: strptime() expects exactly 2 parameters, 3 given in %s on line %d
                     53: NULL
                     54: ===DONE===
                     55: 

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