Exemplo n.º 1
0
 public function __construct()
 {
     $this->startTime = time();
     $this->eventListener = new Core_EventListener();
     $script = array_shift($_SERVER['argv']);
     array_shift($_SERVER['argv']);
     array_unshift($_SERVER['argv'], $script);
     $_SERVER['argc'] = count($_SERVER['argv']);
     $this->argv = $_SERVER['argv'];
     $cmd = Core_Config::getInstance()->get('default/phpunit_command');
     $this->PUOptions[self::CFG_PHPUNIT_CMD] = $cmd ? $cmd : $this->PUOptions[self::CFG_PHPUNIT_CMD];
     $maxThread = Core_Config::getInstance()->get('default/max_thread');
     $this->PUOptions[self::CFG_MAX_THREAD] = $maxThread ? $maxThread : $this->PUOptions[self::CFG_MAX_THREAD];
     $plugins = Core_Config::getInstance()->get('plugin');
     foreach ($plugins as $name => $isEnabled) {
         if ($isEnabled) {
             $className = $name;
             if (strpos($className, 'Plugin_') !== 0) {
                 $className = 'Plugin_' . $className;
             }
             $className = __NAMESPACE__ . '\\' . $className;
             $this->pluginList[] = new $className($this);
         }
     }
     $this->runDaemon = new Core_RunDaemon();
 }
Exemplo n.º 2
0
function parallel_runner_loader($className)
{
    $namespace = '';
    if (strpos($className, '\\') > 0) {
        $tmp = explode('\\', $className);
        $namespace = $tmp[0];
        $className = $tmp[1];
    }
    if (!empty($namespace) && $namespace != __NAMESPACE__) {
        return;
    }
    $path = str_replace(array('\\', '_'), '/', $className) . '.php';
    $filename = PATH_LIB . '/' . $path;
    if (strpos($className, 'PHPUnit_') === 0) {
        $src = rtrim(Core_Config::getInstance()->get('src/phpunit/phpunit'), '/') . '/';
        $filename = $src . $path;
    } else {
        if (strpos($className, 'File_Iterator') === 0) {
            $src = rtrim(Core_Config::getInstance()->get('src/phpunit/php_file_iterator'), '/') . '/';
            $filename = $src . $path;
        } else {
            if (strpos($className, 'PHP_CodeCoverage') === 0) {
                $src = rtrim(Core_Config::getInstance()->get('src/phpunit/php_code_coverage'), '/') . '/';
                $filename = $src . $path;
            }
        }
    }
    if (file_exists($filename)) {
        require_once $filename;
    }
}