Return to get_declared_traits_variation1.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / class_object |
1.1 misho 1: --TEST-- 2: Test get_declared_traits() function : testing autoloaded traits 3: --FILE-- 4: <?php 5: /* Prototype : proto array get_declared_traits() 6: * Description: Returns an array of all declared traits. 7: * Source code: Zend/zend_builtin_functions.c 8: * Alias to functions: 9: */ 10: 11: 12: echo "*** Testing get_declared_traits() : testing autoloaded traits ***\n"; 13: 14: function __autoload($trait_name) { 15: require_once $trait_name . '.inc'; 16: } 17: 18: echo "\n-- before instance is declared --\n"; 19: var_dump(in_array('AutoTrait', get_declared_traits())); 20: 21: echo "\n-- after use is declared --\n"; 22: 23: class MyClass { 24: use AutoTrait; 25: } 26: 27: var_dump(in_array('AutoTrait', get_declared_traits())); 28: 29: echo "\nDONE\n"; 30: 31: ?> 32: --EXPECTF-- 33: *** Testing get_declared_traits() : testing autoloaded traits *** 34: 35: -- before instance is declared -- 36: bool(false) 37: 38: -- after use is declared -- 39: bool(true) 40: 41: DONE