Beispiel #1
0
// ensure http[s]:// in testUrl
if (array_key_exists('testUrl', TestConfig::$config) && !(substr(TestConfig::$config['testUrl'], 0, 7) == 'http://' || substr(TestConfig::$config['testUrl'], 0, 8) == 'https://')) {
    TestConfig::$config['testUrl'] = 'http://' . TestConfig::$config['testUrl'];
}
putenv('thisTestRun_testRunnerPath=' . $testRunnerPath);
putenv('thisTestRun_testIncludePath=' . TestConfig::getConfig('testIncludePath'));
// install CM5 - config and database
$output[] = "-------------------------------------------------";
$output[] = "TEST CONFIGURATION ";
$output[] = "-------------------------------------------------";
foreach (TestConfig::$config as $k => $v) {
    $output[] = $k . "=" . $v;
}
if (!(!empty(TestConfig::$config['skipInstall']) && TestConfig::$config['skipInstall'] === 'true') && !empty(TestConfig::$config['cmFivePath'])) {
    $output[] = "-------------------------------------------------";
    $installer = new CmFiveInstaller();
    $output = array_merge($output, $installer->install(TestConfig::$config));
    $output[] = "-------------------------------------------------";
    $output[] = "INSTALLED CMFIVE";
    $output[] = "-------------------------------------------------";
}
// DUMP OUTPUT
if (php_sapi_name() == 'cli') {
    echo implode("\n", $output);
    $output = array();
}
// clean combined output path
FileSystemTools::prune(TestConfig::getConfig('testOutputPath'));
// find all test folders
$output[] = "-------------------------------------------------";
$output[] = "FOUND TEST FOLDERS";
use Ifsnop\Mysqldump as IMysqldump;
if (!defined('DS')) {
    define('DS', DIRECTORY_SEPARATOR);
}
$testRunnerPath = dirname(dirname(__FILE__));
require $testRunnerPath . DS . 'src' . DS . 'CmFiveTestModuleGenerator.php';
require_once $testRunnerPath . DS . 'src' . DS . 'FileSystemTools.php';
require_once $testRunnerPath . DS . 'composer' . DS . 'vendor' . DS . 'autoload.php';
if (php_sapi_name() == 'cli') {
    // now we have all required parameters
    // check if we need to automatically run the installer on inclusion of this file
    if (count($argv) > 1 && $argv[1] == "install") {
        $response = CmFiveInstaller::findConfig($argv);
        if (count($response['errors']) == 0) {
            $config = $response['config'];
            $installer = new CmFiveInstaller();
            echo implode("\n", $installer->install($config));
        } else {
            echo implode("\n", $response['errors']);
        }
    }
}
class CmFiveInstaller
{
    var $initialised = false;
    var $w;
    var $config;
    var $pdo;
    public function init($config)
    {
        $this->config = $config;