Annotation of embedaddon/php/ext/standard/tests/general_functions/get_defined_constants_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test get_defined_constants() function : basic functionality
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : array get_defined_constants ([ bool $categorize ] )
! 6: * Description: Returns an associative array with the names of all the constants and their values
! 7: * Source code: Zend/zend_builtin_functions.c
! 8: */
! 9:
! 10: echo "*** Testing get_defined_constants() : basic functionality ***\n";
! 11:
! 12: var_dump(gettype(get_defined_constants(true)));
! 13: var_dump(gettype(get_defined_constants()));
! 14:
! 15: $arr1 = get_defined_constants(false);
! 16: $arr2 = get_defined_constants();
! 17: var_dump(array_diff($arr1, $arr2));
! 18:
! 19: $n1 = count(get_defined_constants());
! 20: define("USER_CONSTANT", "test");
! 21: $arr2 = get_defined_constants();
! 22: $n2 = count($arr2);
! 23:
! 24: if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) {
! 25: echo "TEST PASSED\n";
! 26: } else {
! 27: echo "TEST FAILED\n";
! 28: }
! 29:
! 30: ?>
! 31: ===DONE===
! 32: --EXPECTF--
! 33: *** Testing get_defined_constants() : basic functionality ***
! 34: string(5) "array"
! 35: string(5) "array"
! 36: array(0) {
! 37: }
! 38: TEST PASSED
! 39: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>