Annotation of embedaddon/php/ext/standard/tests/class_object/trait_exists_basic_001.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test trait_exists() function : basic functionality 
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : proto bool trait_exists(string traitname [, bool autoload])
                      6:  * Description: Checks if the trait exists 
                      7:  * Source code: Zend/zend_builtin_functions.c
                      8:  * Alias to functions: 
                      9:  */
                     10: 
                     11: echo "*** Testing trait_exists() : basic functionality ***\n";
                     12: 
                     13: function __autoload($traitName) {
                     14:        echo "In __autoload($traitName)\n";
                     15: }
                     16: 
                     17: trait MyTrait {}
                     18: 
                     19: echo "Calling trait_exists() on non-existent trait with autoload explicitly enabled:\n";
                     20: var_dump( trait_exists('C', true) );
                     21: echo "\nCalling trait_exists() on existing trait with autoload explicitly enabled:\n";
                     22: var_dump( trait_exists('MyTrait', true) );
                     23: 
                     24: echo "\nCalling trait_exists() on non-existent trait with autoload explicitly enabled:\n";
                     25: var_dump( trait_exists('D', false) );
                     26: echo "\nCalling trait_exists() on existing trait with autoload explicitly disabled:\n";
                     27: var_dump( trait_exists('MyTrait', false) );
                     28: 
                     29: echo "\nCalling trait_exists() on non-existent trait with autoload unspecified:\n";
                     30: var_dump( trait_exists('E') );
                     31: echo "\nCalling trait_exists() on existing trait with autoload unspecified:\n";
                     32: var_dump( trait_exists('MyTrait') );
                     33: 
                     34: echo "Done";
                     35: ?>
                     36: --EXPECTF--
                     37: *** Testing trait_exists() : basic functionality ***
                     38: Calling trait_exists() on non-existent trait with autoload explicitly enabled:
                     39: In __autoload(C)
                     40: bool(false)
                     41: 
                     42: Calling trait_exists() on existing trait with autoload explicitly enabled:
                     43: bool(true)
                     44: 
                     45: Calling trait_exists() on non-existent trait with autoload explicitly enabled:
                     46: bool(false)
                     47: 
                     48: Calling trait_exists() on existing trait with autoload explicitly disabled:
                     49: bool(true)
                     50: 
                     51: Calling trait_exists() on non-existent trait with autoload unspecified:
                     52: In __autoload(E)
                     53: bool(false)
                     54: 
                     55: Calling trait_exists() on existing trait with autoload unspecified:
                     56: bool(true)
                     57: Done

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