Annotation of embedaddon/php/ext/session/tests/session_cache_limiter_error.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test session_cache_limiter() function : error functionality
                      3: --SKIPIF--
                      4: <?php include('skipif.inc'); ?>
                      5: --FILE--
                      6: <?php
                      7: 
                      8: ob_start();
                      9: 
                     10: /* 
                     11:  * Prototype : string session_cache_limiter([string $cache_limiter])
                     12:  * Description : Get and/or set the current cache limiter
                     13:  * Source code : ext/session/session.c 
                     14:  */
                     15: 
                     16: echo "*** Testing session_cache_limiter() : error functionality ***\n";
                     17: 
                     18: // Get an unset variable
                     19: $unset_var = 10;
                     20: unset($unset_var);
                     21: 
                     22: class classA
                     23: {
                     24:     public function __toString() {
                     25:         return "Hello World!";
                     26:     }
                     27: }
                     28: 
                     29: $heredoc = <<<EOT
                     30: Hello World!
                     31: EOT;
                     32: 
                     33: $fp = fopen(__FILE__, "r");
                     34: 
                     35: // Unexpected values to be passed as arguments
                     36: $inputs = array(
                     37: 
                     38:        // Integer data
                     39: /*1*/  0,
                     40:        1,
                     41:        12345,
                     42:        -2345,
                     43: 
                     44:        // Float data
                     45: /*5*/  10.5,
                     46:        -10.5,
                     47:        12.3456789000e10,
                     48:        12.3456789000E-10,
                     49:        .5,
                     50: 
                     51:        // Null data
                     52: /*10*/ NULL,
                     53:        null,
                     54: 
                     55:        // Boolean data
                     56: /*12*/ true,
                     57:        false,
                     58:        TRUE,
                     59:        FALSE,
                     60:        
                     61:        // Empty strings
                     62: /*16*/ "",
                     63:        '',
                     64: 
                     65:        // Invalid string data
                     66: /*18*/ "Nothing",
                     67:        'Nothing',
                     68:        $heredoc,
                     69:        
                     70:        // Object data
                     71: /*21*/ new classA(),
                     72: 
                     73:        // Undefined data
                     74: /*22*/ @$undefined_var,
                     75: 
                     76:        // Unset data
                     77: /*23*/ @$unset_var,
                     78: 
                     79:        // Resource variable
                     80: /*24*/ $fp
                     81: );
                     82: 
                     83: 
                     84: $iterator = 1;
                     85: foreach($inputs as $input) {
                     86:     echo "\n-- Iteration $iterator --\n";
                     87:     var_dump(session_cache_limiter($input));
                     88:     $iterator++;
                     89: };
                     90: 
                     91: fclose($fp);
                     92: echo "Done";
                     93: ob_end_flush();
                     94: ?>
                     95: --EXPECTF--
                     96: *** Testing session_cache_limiter() : error functionality ***
                     97: 
                     98: -- Iteration 1 --
                     99: string(7) "nocache"
                    100: 
                    101: -- Iteration 2 --
                    102: string(1) "0"
                    103: 
                    104: -- Iteration 3 --
                    105: string(1) "1"
                    106: 
                    107: -- Iteration 4 --
                    108: string(5) "12345"
                    109: 
                    110: -- Iteration 5 --
                    111: string(5) "-2345"
                    112: 
                    113: -- Iteration 6 --
                    114: string(4) "10.5"
                    115: 
                    116: -- Iteration 7 --
                    117: string(5) "-10.5"
                    118: 
                    119: -- Iteration 8 --
                    120: string(12) "123456789000"
                    121: 
                    122: -- Iteration 9 --
                    123: string(13) "1.23456789E-9"
                    124: 
                    125: -- Iteration 10 --
                    126: string(3) "0.5"
                    127: 
                    128: -- Iteration 11 --
                    129: string(0) ""
                    130: 
                    131: -- Iteration 12 --
                    132: string(0) ""
                    133: 
                    134: -- Iteration 13 --
                    135: string(1) "1"
                    136: 
                    137: -- Iteration 14 --
                    138: string(0) ""
                    139: 
                    140: -- Iteration 15 --
                    141: string(1) "1"
                    142: 
                    143: -- Iteration 16 --
                    144: string(0) ""
                    145: 
                    146: -- Iteration 17 --
                    147: string(0) ""
                    148: 
                    149: -- Iteration 18 --
                    150: string(0) ""
                    151: 
                    152: -- Iteration 19 --
                    153: string(7) "Nothing"
                    154: 
                    155: -- Iteration 20 --
                    156: string(7) "Nothing"
                    157: 
                    158: -- Iteration 21 --
                    159: string(12) "Hello World!"
                    160: 
                    161: -- Iteration 22 --
                    162: string(12) "Hello World!"
                    163: 
                    164: -- Iteration 23 --
                    165: string(0) ""
                    166: 
                    167: -- Iteration 24 --
                    168: 
                    169: Warning: session_cache_limiter() expects parameter 1 to be string, resource given in %s on line %d
                    170: NULL
                    171: Done
                    172: 

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