Annotation of embedaddon/php/ext/standard/tests/general_functions/uniqid_basic.phpt, revision 1.1.1.2
1.1.1.2 ! misho 1: --TEST--
! 2: Test uniqid() function : basic functionality
! 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() : basic functionality ***\n";
! 10:
! 11: echo "\nuniqid() without a prefix\n";
! 12: var_dump(uniqid());
! 13: var_dump(uniqid(null, true));
! 14: var_dump(uniqid(null, false));
! 15: echo "\n\n";
! 16:
! 17: echo "uniqid() with a prefix\n";
! 18:
! 19: // Use a fixed prefix so we can ensure length of o/p id is fixed
! 20: $prefix = array (
! 21: 99999,
! 22: "99999",
! 23: 10.5e2,
! 24: null,
! 25: true,
! 26: false
! 27: );
! 28:
! 29: for ($i = 0; $i < count($prefix); $i++) {
! 30: var_dump(uniqid($prefix[$i]));
! 31: var_dump(uniqid($prefix[$i], true));
! 32: var_dump(uniqid($prefix[$i], false));
! 33: echo "\n";
! 34: }
! 35:
! 36: ?>
! 37: ===DONE===
! 38: --EXPECTF--
! 39: *** Testing uniqid() : basic functionality ***
! 40:
! 41: uniqid() without a prefix
! 42: string(13) "%s"
! 43: string(23) "%s.%s"
! 44: string(13) "%s"
! 45:
! 46:
! 47: uniqid() with a prefix
! 48: string(18) "99999%s"
! 49: string(28) "99999%s.%s"
! 50: string(18) "99999%s"
! 51:
! 52: string(18) "99999%s"
! 53: string(28) "99999%s.%s"
! 54: string(18) "99999%s"
! 55:
! 56: string(17) "1050%s"
! 57: string(27) "1050%s.%s"
! 58: string(17) "1050%s"
! 59:
! 60: string(13) "%s"
! 61: string(23) "%s.%s"
! 62: string(13) "%s"
! 63:
! 64: string(14) "1%s"
! 65: string(24) "1%s.%s"
! 66: string(14) "1%s"
! 67:
! 68: string(13) "%s"
! 69: string(23) "%s.%s"
! 70: string(13) "%s"
! 71:
! 72: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>