Annotation of embedaddon/php/ext/spl/tests/class_uses_variation.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: SPL: Test class_uses() function : variation - no interfaces and autoload
3: --FILE--
4: <?php
5: /* Prototype : array class_uses(mixed what [, bool autoload ])
6: * Description: Return all traits used by a class
7: * Source code: ext/spl/php_spl.c
8: * Alias to functions:
9: */
10:
11: echo "*** Testing class_uses() : variation ***\n";
12:
13: echo "--- testing no traits ---\n";
14: class fs {}
15: var_dump(class_uses(new fs));
16: var_dump(class_uses('fs'));
17:
18: echo "\n--- testing autoload ---\n";
1.1.1.2 ! misho 19: var_dump(class_uses('non_existent'));
! 20: var_dump(class_uses('non_existent2', false));
1.1 misho 21:
22:
23: function __autoload($classname) {
24: echo "attempting to autoload $classname\n";
25: }
26:
27: ?>
28: ===DONE===
29: --EXPECTF--
30: *** Testing class_uses() : variation ***
31: --- testing no traits ---
32: array(0) {
33: }
34: array(0) {
35: }
36:
37: --- testing autoload ---
1.1.1.2 ! misho 38: attempting to autoload non_existent
1.1 misho 39:
1.1.1.2 ! misho 40: Warning: class_uses(): Class non_existent does not exist and could not be loaded in %s on line %d
1.1 misho 41: bool(false)
42:
1.1.1.2 ! misho 43: Warning: class_uses(): Class non_existent2 does not exist in %s on line %d
1.1 misho 44: bool(false)
45: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>