#!/usr/bin/env php
<?php
if ($GLOBALS['_SERVER']['SCRIPT_NAME'] != '-') {
    $phar = realpath($GLOBALS['_SERVER']['SCRIPT_NAME']);
} else {
    $files = get_included_files();
    $phar = $files[0];
}

define('__PHPUNIT_PHAR__', str_replace(DIRECTORY_SEPARATOR, '/', $phar));

spl_autoload_register(
  function ($class)
  {
      static $classes = NULL;

      if ($classes === NULL) {
          $classes = array(
            ___CLASSLIST___
          );
      }

      $class = strtolower($class);

      if (isset($classes[$class])) {
          require 'phar://___PHAR___' . $classes[$class];
      }
  }
);

Phar::mapPhar('___PHAR___');

if ($GLOBALS['_SERVER']['SCRIPT_NAME'] != '-') {
    PHPUnit_TextUI_Command::main();
}

__HALT_COMPILER();
