示例#1
0
function make_defines($array, $prefix = null)
{
    static $dirs = array();
    foreach ($array as $key => $value) {
        $key = strtoupper(ltrim("{$prefix}_{$key}", '_'));
        if (is_array($value)) {
            make_defines($value, $key);
            continue;
        }
        if (!defined($key)) {
            define($key, $value);
        }
        // Track _DIR entries.
        if (preg_match(';^(.+)_DIR$;', $key, $regs)) {
            $dirs[] = $regs[1];
        }
    }
    // Create _ROOT entries relative to DEPLOY_ROOT for all _DIR entries.
    if ($prefix === null && defined('DEPLOY_ROOT')) {
        foreach ($dirs as $prefix) {
            $dirKey = "{$prefix}_DIR";
            if (!defined($dirKey)) {
                continue;
            }
            $rootKey = "{$prefix}_ROOT";
            if (defined($rootKey)) {
                continue;
            }
            $dir = constant($dirKey);
            if (!preg_match(';^/;', $dir)) {
                $dir = constant('DEPLOY_ROOT') . "/{$dir}";
            }
            define($rootKey, $dir);
        }
    }
}
示例#2
0
                         }
                         $has_ext = $has_ext || $has_all;
                     } else {
                         $has_ext = $has_ext || extension_loaded($required_ext) || isset($exts[$required_ext]);
                     }
                 }
             }
             if ($has_ext) {
                 $defines2 = make_defines($exts, array_merge($disabled_exts, array_diff($lazy_load_exts, explode('|', $required_exts))), TRUE);
                 // Here we hijack the user_dir ini setting to pass data into the test
                 $configs[$name] = "{$phpbin} {$ini_path} -d user_dir=\"DB_NAME:{$db_name}{$key_value_string}\" {$defines} {$defines2} {$phpunit} " . ($bootstrap ? ' --bootstrap ' . escapeshellarg($bootstrap) : '');
             } else {
                 throw new Exception();
             }
         } catch (Exception $e) {
             $defines = make_defines($exts, $lazy_load_exts);
             $configs[$name] = "{$phpbin} {$ini_path} -d user_dir=\"DB_NAME:{$db_name},SKIPPING:1{$key_value_string}\" {$defines} {$phpunit} " . ($bootstrap ? ' --bootstrap ' . escapeshellarg($bootstrap) : '');
         }
     }
 } elseif (!$config_regex) {
     $custom_ini_path = $ini_path == ' -n ' ? '' : $ini_path;
     $configs[''] = "{$phpunit} {$custom_ini_path}";
 }
 /* ---------------------------------------------------------- */
 /* For each different configuration, run the tests
 		/* ---------------------------------------------------------- */
 $php_errors = 0;
 foreach ($configs as $name => $config) {
     $xml_flag = version_compare($phpunit_version, '3.4', '<') ? '--log-xml' : '--log-junit';
     $filter = strlen($filter_pattern) ? '--filter ' . escapeshellarg($filter_pattern) : '';
     if ($format == 'shell') {