Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added Mocks to test autoloader

Signed-off-by: Darren Hill <dchill42@gmail.com>
  • Loading branch information...
commit b44e3ede8b55a94da16f782db36cc31dde055ecf 1 parent 56ac5be
@dchill42 dchill42 authored
Showing with 15 additions and 6 deletions.
  1. +15 −6 tests/Bootstrap.php
View
21 tests/Bootstrap.php
@@ -74,12 +74,21 @@ class_alias('org\bovigo\vfs\vfsStreamDirectory', 'vfsStreamDirectory');
spl_autoload_register(function ($class) {
// Break out namespace and class
$parts = explode('\\', trim($class, '\\'));
- if ($parts[0] == 'Xylophone') {
- // Remove system namespace
- array_shift($parts);
-
- // Include reassembled namespace as path to source file
- include_once BASEPATH.'system/'.implode('/', $parts).'.php';
+ switch ($parts[0]) {
+ case 'Xylophone':
+ $path = 'system/';
+ break;
+ case 'Mocks':
+ $path = 'tests/Mocks/';
+ break;
+ default:
+ return;
}
+
+ // Remove top-level namespace
+ array_shift($parts);
+
+ // Include reassembled namespace as path to source file
+ include_once BASEPATH.$path.implode('/', $parts).'.php';
});
Please sign in to comment.
Something went wrong with that request. Please try again.