xref: /php-src/ext/spl/tests/spl_autoload_003.phpt (revision f8d79582)
1--TEST--
2SPL: spl_autoload() and friends
3--INI--
4include_path=.
5--FILE--
6<?php
7
8function TestFunc1($classname)
9{
10    echo __METHOD__ . "($classname)\n";
11}
12
13function TestFunc2($classname)
14{
15    echo __METHOD__ . "($classname)\n";
16    throw new Exception("Class $classname missing");
17}
18
19function TestFunc3($classname)
20{
21    echo __METHOD__ . "($classname)\n";
22}
23
24spl_autoload_register("TestFunc1");
25spl_autoload_register("TestFunc2");
26spl_autoload_register("TestFunc3");
27
28try
29{
30    var_dump(class_exists("TestClass", true));
31}
32catch(Exception $e)
33{
34    echo 'Exception: ' . $e->getMessage() . "\n";
35}
36
37?>
38--EXPECT--
39TestFunc1(TestClass)
40TestFunc2(TestClass)
41Exception: Class TestClass missing
42