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