Passed
Push — 1.0.0-dev ( ead601...e21083 )
by nguereza
04:39
created

tests_autoload()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 46
Code Lines 39

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 3
eloc 39
nc 3
nop 1
dl 0
loc 46
rs 9.296
c 1
b 1
f 0
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_PATH . 'Database.php',
16
			'DBSessionHandler' => CORE_CLASSES_PATH . 'DBSessionHandler.php',
17
			'EventInfo' => CORE_CLASSES_PATH . 'EventInfo.php',
18
			'EventDispatcher' => CORE_CLASSES_PATH . 'EventDispatcher.php',
19
			'Lang' => CORE_CLASSES_PATH . 'Lang.php',
20
			'Loader' => CORE_CLASSES_PATH . 'Loader.php',
21
			'Log' => CORE_CLASSES_PATH . 'Log.php',
22
			'Module' => CORE_CLASSES_PATH . 'Module.php',
23
			'Request' => CORE_CLASSES_PATH . 'Request.php',
24
			'Response' => CORE_CLASSES_PATH . 'Response.php',
25
			'Router' => CORE_CLASSES_PATH . 'Router.php',
26
			'Security' => CORE_CLASSES_PATH . 'Security.php',
27
			'Session' => CORE_CLASSES_PATH . 'Session.php',
28
			'Url' => CORE_CLASSES_PATH . 'Url.php',
29
			//Core libraries
30
			'Assets' => CORE_LIBRARY_PATH . 'Assets.php',
31
			'Benchmark' => CORE_LIBRARY_PATH . 'Benchmark.php',
32
			'Browser' => CORE_LIBRARY_PATH . 'Browser.php',
33
			'Cookie' => CORE_LIBRARY_PATH . 'Cookie.php',
34
			'Email' => CORE_LIBRARY_PATH . 'Email.php',
35
			'Form' => CORE_LIBRARY_PATH . 'Form.php',
36
			'FormValidation' => CORE_LIBRARY_PATH . 'FormValidation.php',
37
			'Html' => CORE_LIBRARY_PATH . 'Html.php',
38
			'Pagination' => CORE_LIBRARY_PATH . 'Pagination.php',
39
			'PDF' => CORE_LIBRARY_PATH . 'PDF.php',
40
			'StringHash' => CORE_LIBRARY_PATH . 'StringHash.php',
41
			'Upload' => CORE_LIBRARY_PATH . 'Upload.php',
42
		);
43
		if(isset($classesMap[$class])){
44
			if(file_exists($classesMap[$class])){
45
				require_once $classesMap[$class];
46
			}
47
			else{
48
				echo 'File for class ' . $class . ' not found';
49
			}
50
		}
51
	}