Permalink
Browse files

Updated Autoloader to work with Test suite.

Stash is located in '/src', while the test suite is in '/tests'. The
provided autoloader only supported '/src' which made testing without
composer difficult.
  • Loading branch information...
1 parent 7f47019 commit 0d4b906be9d797cc6b591992b7f9e2db14a31a60 @tedivm tedivm committed Dec 27, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 autoload.php
View
@@ -11,7 +11,14 @@
spl_autoload_register(function($class)
{
- $file = __DIR__.'/src/'.strtr($class, '\\', '/').'.php';
+ $base = '/src/';
+
+ if(strpos($class, 'Stash\Test') === 0)
+ {
+ $base = '/tests/';
+ }
+
+ $file = __DIR__.$base.strtr($class, '\\', '/').'.php';
if (file_exists($file)) {
require $file;
return true;

0 comments on commit 0d4b906

Please sign in to comment.