Annotation of embedaddon/php/ext/standard/tests/general_functions/uniqid_error.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test uniqid() function : error conditions
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : string uniqid  ([ string $prefix= ""  [, bool $more_entropy= false  ]] )
        !             6:  * Description: Gets a prefixed unique identifier based on the current time in microseconds. 
        !             7:  * Source code: ext/standard/uniqid.c
        !             8: */
        !             9: echo "*** Testing uniqid() : error conditions ***\n";
        !            10: 
        !            11: echo "\n-- Testing uniqid() function with more than expected no. of arguments --\n";
        !            12: $prefix = null;
        !            13: $more_entropy = false;
        !            14: $extra_arg = false;
        !            15: var_dump(uniqid($prefix, $more_entropy, $extra_arg));
        !            16: 
        !            17: echo "\n-- Testing uniqid() function with invalid values for \$prefix --\n";
        !            18: class class1{}
        !            19: $obj = new class1();
        !            20: $res = fopen(__FILE__, "r"); 
        !            21: $array = array(1,2,3);
        !            22: 
        !            23: uniqid($array, false);
        !            24: uniqid($res, false);
        !            25: uniqid($obj, false);
        !            26: 
        !            27: fclose($res);
        !            28: 
        !            29: ?>
        !            30: ===DONE===
        !            31: --EXPECTF-- 
        !            32: *** Testing uniqid() : error conditions ***
        !            33: 
        !            34: -- Testing uniqid() function with more than expected no. of arguments --
        !            35: 
        !            36: Warning: uniqid() expects at most 2 parameters, 3 given in %s on line %d
        !            37: NULL
        !            38: 
        !            39: -- Testing uniqid() function with invalid values for $prefix --
        !            40: 
        !            41: Warning: uniqid() expects parameter 1 to be string, array given in %s on line %d
        !            42: 
        !            43: Warning: uniqid() expects parameter 1 to be string, resource given in %s on line %d
        !            44: 
        !            45: Warning: uniqid() expects parameter 1 to be string, object given in %s on line %d
        !            46: ===DONE===

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