Skip to content

Commit

Permalink
Merge pull request #56 from tedivm/test_change
Browse files Browse the repository at this point in the history
Test Bootstrapper Updates
  • Loading branch information
tedivm committed Dec 28, 2012
2 parents 7f47019 + 3d6f5c7 commit ef4b784
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 8 additions & 1 deletion autoload.php
Expand Up @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions tests/bootstrap.php
Expand Up @@ -17,8 +17,11 @@
$filename = __DIR__ .'/../vendor/autoload.php';

if (!file_exists($filename)) {
throw new Exception("You need to execute `composer install` before running the tests. (vendors are required for test execution)");
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" . PHP_EOL;
echo "You need to execute `composer install` before running the tests." . PHP_EOL;
echo "(vendors are required for test execution)" . PHP_EOL;
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" . PHP_EOL . PHP_EOL;
$filename = __DIR__ .'/../autoload.php';
}

require_once $filename;

0 comments on commit ef4b784

Please sign in to comment.