Annotation of embedaddon/php/ext/date/tests/date_default_timezone_set_variation1.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test date_default_timezone_set() function : usage variations - Passing unexpected values for time_zone identifier
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : bool date_default_timezone_set ( string $timezone_identifier )
                      6:  * Description:  Sets the default timezone used by all date/time functions in a script.
                      7:  * Source code: ext/standard/data/php_date.c
                      8:  */
                      9: 
                     10: echo "*** Testing date_default_timezone_set() : usage variations ***\n";
                     11: //get an unset variable
                     12: $unset_var = 10;
                     13: unset ($unset_var);
                     14: 
                     15: // heredoc string
                     16: $heredoc = <<<EOT
                     17: abc
                     18: xyz
                     19: EOT;
                     20: 
                     21: // get a resource variable
                     22: $fp = fopen(__FILE__, "r");
                     23: 
                     24: $inputs = array(
                     25:        // int data
                     26: /*1*/  0,
                     27:        1,
                     28:        12345,
                     29:        -2345,
                     30: 
                     31:        // float data
                     32: /*5*/  10.5,
                     33:        -10.5,
                     34:        12.3456789000e10,
                     35:        12.3456789000E-10,
                     36:        .5,
                     37: 
                     38:        // null data
                     39: /*10*/ NULL,
                     40:        null,
                     41: 
                     42:        // boolean data
                     43: /*12*/ true,
                     44:        false,
                     45:        TRUE,
                     46:        FALSE,
                     47:        
                     48:        // empty data
                     49: /*16*/ "",
                     50:        '',
                     51:        array(),
                     52: 
                     53:        // string data
                     54: /*19*/ "abcxyz",
                     55:        'abcxyz',
                     56:        $heredoc,
                     57:        
                     58:        // undefined data
                     59: /*22*/ @$undefined_var,
                     60: 
                     61:        // unset data
                     62: /*23*/ @$unset_var,
                     63: 
                     64:        // resource variable
                     65: /*24*/ $fp
                     66: );
                     67: 
                     68: // loop through each element of $inputs to check the behaviour of date_default_timezone_set()
                     69: $iterator = 1;
                     70: foreach($inputs as $input) {
                     71:     echo "\n-- Iteration $iterator --\n";
                     72:     var_dump(date_default_timezone_set($input));
                     73:     $iterator++;
                     74: };
                     75: ?>
                     76: ===Done===
                     77: --EXPECTF--
                     78: *** Testing date_default_timezone_set() : usage variations ***
                     79: 
                     80: -- Iteration 1 --
                     81: 
                     82: Notice: date_default_timezone_set(): Timezone ID '0' is invalid in %s on line %d
                     83: bool(false)
                     84: 
                     85: -- Iteration 2 --
                     86: 
                     87: Notice: date_default_timezone_set(): Timezone ID '1' is invalid in %s on line %d
                     88: bool(false)
                     89: 
                     90: -- Iteration 3 --
                     91: 
                     92: Notice: date_default_timezone_set(): Timezone ID '12345' is invalid in %s on line %d
                     93: bool(false)
                     94: 
                     95: -- Iteration 4 --
                     96: 
                     97: Notice: date_default_timezone_set(): Timezone ID '-2345' is invalid in %s on line %d
                     98: bool(false)
                     99: 
                    100: -- Iteration 5 --
                    101: 
                    102: Notice: date_default_timezone_set(): Timezone ID '10.5' is invalid in %s on line %d
                    103: bool(false)
                    104: 
                    105: -- Iteration 6 --
                    106: 
                    107: Notice: date_default_timezone_set(): Timezone ID '-10.5' is invalid in %s on line %d
                    108: bool(false)
                    109: 
                    110: -- Iteration 7 --
                    111: 
                    112: Notice: date_default_timezone_set(): Timezone ID '123456789000' is invalid in %s on line %d
                    113: bool(false)
                    114: 
                    115: -- Iteration 8 --
                    116: 
                    117: Notice: date_default_timezone_set(): Timezone ID '1.23456789E-9' is invalid in %s on line %d
                    118: bool(false)
                    119: 
                    120: -- Iteration 9 --
                    121: 
                    122: Notice: date_default_timezone_set(): Timezone ID '0.5' is invalid in %s on line %d
                    123: bool(false)
                    124: 
                    125: -- Iteration 10 --
                    126: 
                    127: Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
                    128: bool(false)
                    129: 
                    130: -- Iteration 11 --
                    131: 
                    132: Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
                    133: bool(false)
                    134: 
                    135: -- Iteration 12 --
                    136: 
                    137: Notice: date_default_timezone_set(): Timezone ID '1' is invalid in %s on line %d
                    138: bool(false)
                    139: 
                    140: -- Iteration 13 --
                    141: 
                    142: Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
                    143: bool(false)
                    144: 
                    145: -- Iteration 14 --
                    146: 
                    147: Notice: date_default_timezone_set(): Timezone ID '1' is invalid in %s on line %d
                    148: bool(false)
                    149: 
                    150: -- Iteration 15 --
                    151: 
                    152: Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
                    153: bool(false)
                    154: 
                    155: -- Iteration 16 --
                    156: 
                    157: Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
                    158: bool(false)
                    159: 
                    160: -- Iteration 17 --
                    161: 
                    162: Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
                    163: bool(false)
                    164: 
                    165: -- Iteration 18 --
                    166: 
                    167: Warning: date_default_timezone_set() expects parameter 1 to be string, array given in %s on line %d
                    168: bool(false)
                    169: 
                    170: -- Iteration 19 --
                    171: 
                    172: Notice: date_default_timezone_set(): Timezone ID 'abcxyz' is invalid in %s on line %d
                    173: bool(false)
                    174: 
                    175: -- Iteration 20 --
                    176: 
                    177: Notice: date_default_timezone_set(): Timezone ID 'abcxyz' is invalid in %s on line %d
                    178: bool(false)
                    179: 
                    180: -- Iteration 21 --
                    181: 
                    182: Notice: date_default_timezone_set(): Timezone ID 'abc
                    183: xyz' is invalid in %s on line %d
                    184: bool(false)
                    185: 
                    186: -- Iteration 22 --
                    187: 
                    188: Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
                    189: bool(false)
                    190: 
                    191: -- Iteration 23 --
                    192: 
                    193: Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
                    194: bool(false)
                    195: 
                    196: -- Iteration 24 --
                    197: 
                    198: Warning: date_default_timezone_set() expects parameter 1 to be string, resource given in %s on line %d
                    199: bool(false)
                    200: ===Done===

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