Annotation of embedaddon/php/ext/date/tests/date_parse_error.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test date_parse() function : error conditions 
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : array date_parse  ( string $date  ) 
        !             6:  * Description: Returns associative array with detailed info about given date.
        !             7:  * Source code: ext/date/php_date.c
        !             8:  */
        !             9:  
        !            10: //Set the default time zone 
        !            11: date_default_timezone_set("Europe/London");
        !            12: 
        !            13: echo "*** Testing date_parse() : error conditions ***\n";
        !            14: 
        !            15: echo "\n-- Testing date_parse() function with zero arguments --\n";
        !            16: var_dump( date_parse() );
        !            17: 
        !            18: echo "\n-- Testing date_parse() function with more than expected no. of arguments --\n";
        !            19: $date = "2009-02-27 10:00:00.5";
        !            20: $extra_arg = 10;
        !            21: var_dump( date_parse($date, $extra_arg) );
        !            22: 
        !            23: echo "\n-- Testing date_parse() function with unexpected characters in \$date argument --\n";
        !            24: $invalid_date = "2OO9-02--27 10:00?00.5";
        !            25: var_dump( date_parse($invalid_date) );  
        !            26: 
        !            27: ?>
        !            28: ===DONE===
        !            29: --EXPECTF--
        !            30: *** Testing date_parse() : error conditions ***
        !            31: 
        !            32: -- Testing date_parse() function with zero arguments --
        !            33: 
        !            34: Warning: date_parse() expects exactly 1 parameter, 0 given in %s on line %d
        !            35: bool(false)
        !            36: 
        !            37: -- Testing date_parse() function with more than expected no. of arguments --
        !            38: 
        !            39: Warning: date_parse() expects exactly 1 parameter, 2 given in %s on line %d
        !            40: bool(false)
        !            41: 
        !            42: -- Testing date_parse() function with unexpected characters in $date argument --
        !            43: array(13) {
        !            44:   ["year"]=>
        !            45:   bool(false)
        !            46:   ["month"]=>
        !            47:   bool(false)
        !            48:   ["day"]=>
        !            49:   bool(false)
        !            50:   ["hour"]=>
        !            51:   int(10)
        !            52:   ["minute"]=>
        !            53:   int(0)
        !            54:   ["second"]=>
        !            55:   int(0)
        !            56:   ["fraction"]=>
        !            57:   float(0)
        !            58:   ["warning_count"]=>
        !            59:   int(1)
        !            60:   ["warnings"]=>
        !            61:   array(1) {
        !            62:     [4]=>
        !            63:     string(29) "Double timezone specification"
        !            64:   }
        !            65:   ["error_count"]=>
        !            66:   int(7)
        !            67:   ["errors"]=>
        !            68:   array(7) {
        !            69:     [0]=>
        !            70:     string(20) "Unexpected character"
        !            71:     [1]=>
        !            72:     string(47) "The timezone could not be found in the database"
        !            73:     [3]=>
        !            74:     string(20) "Unexpected character"
        !            75:     [7]=>
        !            76:     string(20) "Unexpected character"
        !            77:     [8]=>
        !            78:     string(29) "Double timezone specification"
        !            79:     [17]=>
        !            80:     string(20) "Unexpected character"
        !            81:     [18]=>
        !            82:     string(25) "Double time specification"
        !            83:   }
        !            84:   ["is_localtime"]=>
        !            85:   bool(true)
        !            86:   ["zone_type"]=>
        !            87:   int(0)
        !            88: }
        !            89: ===DONE===

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