summaryrefslogtreecommitdiff
path: root/ext/standard/tests/class_object/class_exists_basic_001.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/class_object/class_exists_basic_001.phpt')
-rw-r--r--ext/standard/tests/class_object/class_exists_basic_001.phpt55
1 files changed, 55 insertions, 0 deletions
diff --git a/ext/standard/tests/class_object/class_exists_basic_001.phpt b/ext/standard/tests/class_object/class_exists_basic_001.phpt
new file mode 100644
index 000000000..4cb6cbd32
--- /dev/null
+++ b/ext/standard/tests/class_object/class_exists_basic_001.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test class_exists() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto bool class_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing class_exists() : basic functionality ***\n";
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+echo "Calling class_exists() on non-existent class with autoload explicitly enabled:\n";
+var_dump( class_exists('C', true) );
+echo "\nCalling class_exists() on existing class with autoload explicitly enabled:\n";
+var_dump( class_exists('stdclass', true) );
+
+echo "\nCalling class_exists() on non-existent class with autoload explicitly enabled:\n";
+var_dump( class_exists('D', false) );
+echo "\nCalling class_exists() on existing class with autoload explicitly disabled:\n";
+var_dump( class_exists('stdclass', false) );
+
+echo "\nCalling class_exists() on non-existent class with autoload unspecified:\n";
+var_dump( class_exists('E') );
+echo "\nCalling class_exists() on existing class with autoload unspecified:\n";
+var_dump( class_exists('stdclass') );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing class_exists() : basic functionality ***
+Calling class_exists() on non-existent class with autoload explicitly enabled:
+In __autoload(C)
+bool(false)
+
+Calling class_exists() on existing class with autoload explicitly enabled:
+bool(true)
+
+Calling class_exists() on non-existent class with autoload explicitly enabled:
+bool(false)
+
+Calling class_exists() on existing class with autoload explicitly disabled:
+bool(true)
+
+Calling class_exists() on non-existent class with autoload unspecified:
+In __autoload(E)
+bool(false)
+
+Calling class_exists() on existing class with autoload unspecified:
+bool(true)
+Done \ No newline at end of file