|
1
|
|
|
<?php |
|
2
|
|
|
//Autoload function |
|
3
|
|
|
function tests_autoload($class){ |
|
4
|
|
|
$classesMap = array( |
|
5
|
|
|
//Caches |
|
6
|
|
|
'ApcCache' => CORE_CLASSES_CACHE_PATH . 'ApcCache.php', |
|
7
|
|
|
'CacheInterface' => CORE_CLASSES_CACHE_PATH . 'CacheInterface.php', |
|
8
|
|
|
'FileCache' => CORE_CLASSES_CACHE_PATH . 'FileCache.php', |
|
9
|
|
|
//models |
|
10
|
|
|
'DBSessionHandlerModel' => CORE_CLASSES_MODEL_PATH . 'DBSessionHandlerModel.php', |
|
11
|
|
|
'Model' => CORE_CLASSES_MODEL_PATH . 'Model.php', |
|
12
|
|
|
//Core classes |
|
13
|
|
|
'Config' => CORE_CLASSES_PATH . 'Config.php', |
|
14
|
|
|
'Controller' => CORE_CLASSES_PATH . 'Controller.php', |
|
15
|
|
|
'Database' => CORE_CLASSES_DATABASE_PATH . 'Database.php', |
|
16
|
|
|
'DatabaseQueryBuilder' => CORE_CLASSES_DATABASE_PATH . 'DatabaseQueryBuilder.php', |
|
17
|
|
|
'DatabaseQueryResult' => CORE_CLASSES_DATABASE_PATH . 'DatabaseQueryResult.php', |
|
18
|
|
|
'DatabaseQueryRunner' => CORE_CLASSES_DATABASE_PATH . 'DatabaseQueryRunner.php', |
|
19
|
|
|
'DBSessionHandler' => CORE_CLASSES_PATH . 'DBSessionHandler.php', |
|
20
|
|
|
'EventInfo' => CORE_CLASSES_PATH . 'EventInfo.php', |
|
21
|
|
|
'EventDispatcher' => CORE_CLASSES_PATH . 'EventDispatcher.php', |
|
22
|
|
|
'Lang' => CORE_CLASSES_PATH . 'Lang.php', |
|
23
|
|
|
'Loader' => CORE_CLASSES_PATH . 'Loader.php', |
|
24
|
|
|
'Log' => CORE_CLASSES_PATH . 'Log.php', |
|
25
|
|
|
'Module' => CORE_CLASSES_PATH . 'Module.php', |
|
26
|
|
|
'Request' => CORE_CLASSES_PATH . 'Request.php', |
|
27
|
|
|
'Response' => CORE_CLASSES_PATH . 'Response.php', |
|
28
|
|
|
'Router' => CORE_CLASSES_PATH . 'Router.php', |
|
29
|
|
|
'Security' => CORE_CLASSES_PATH . 'Security.php', |
|
30
|
|
|
'Session' => CORE_CLASSES_PATH . 'Session.php', |
|
31
|
|
|
'Url' => CORE_CLASSES_PATH . 'Url.php', |
|
32
|
|
|
//Core libraries |
|
33
|
|
|
'Assets' => CORE_LIBRARY_PATH . 'Assets.php', |
|
34
|
|
|
'Benchmark' => CORE_LIBRARY_PATH . 'Benchmark.php', |
|
35
|
|
|
'Browser' => CORE_LIBRARY_PATH . 'Browser.php', |
|
36
|
|
|
'Cookie' => CORE_LIBRARY_PATH . 'Cookie.php', |
|
37
|
|
|
'Email' => CORE_LIBRARY_PATH . 'Email.php', |
|
38
|
|
|
'Form' => CORE_LIBRARY_PATH . 'Form.php', |
|
39
|
|
|
'FormValidation' => CORE_LIBRARY_PATH . 'FormValidation.php', |
|
40
|
|
|
'Html' => CORE_LIBRARY_PATH . 'Html.php', |
|
41
|
|
|
'Pagination' => CORE_LIBRARY_PATH . 'Pagination.php', |
|
42
|
|
|
'PDF' => CORE_LIBRARY_PATH . 'PDF.php', |
|
43
|
|
|
'StringHash' => CORE_LIBRARY_PATH . 'StringHash.php', |
|
44
|
|
|
'Upload' => CORE_LIBRARY_PATH . 'Upload.php', |
|
45
|
|
|
); |
|
46
|
|
|
if(isset($classesMap[$class])){ |
|
47
|
|
|
if(file_exists($classesMap[$class])){ |
|
48
|
|
|
require_once $classesMap[$class]; |
|
49
|
|
|
} |
|
50
|
|
|
else{ |
|
51
|
|
|
echo 'File for class ' . $class . ' not found'; |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
} |