public static function setupPlugins($plugins = [])
 {
     $plugins = array_merge(self::defaultPlugins, $plugins);
     foreach (new \DirectoryIterator(DOKU_INC . 'lib/plugins/') as $fi) {
         if ($fi->isDir() && !$fi->isDot() && !in_array($fi->getFilename(), $plugins)) {
             // enable these
             $entry = $fi->getFilename();
             \TestUtils::fappend(vfsStream::url('root/conf/plugins.local.php'), "\$plugins['{$entry}'] = 0;\n");
         }
     }
 }
Beispiel #2
0
    });
} else {
    echo ">>>> Preserving temporary directory: " . TMP_DIR . "\n";
}
// populate default dirs
TestUtils::rcopy(TMP_DIR, DOKU_INC . '/conf');
TestUtils::rcopy(TMP_DIR, dirname(__FILE__) . '/conf');
mkdir(DOKU_TMP_DATA);
foreach (array('attic', 'cache', 'index', 'locks', 'media', 'media_attic', 'media_meta', 'meta', 'pages', 'tmp') as $dir) {
    mkdir(DOKU_TMP_DATA . '/' . $dir);
}
// disable all non-default plugins by default
$dh = dir(DOKU_INC . 'lib/plugins/');
while (false !== ($entry = $dh->read())) {
    if ($entry == '.' || $entry == '..') {
        continue;
    }
    if (!is_dir(DOKU_INC . 'lib/plugins/' . $entry)) {
        continue;
    }
    if (!in_array($entry, $default_plugins)) {
        // disable this plugin
        TestUtils::fappend(DOKU_CONF . 'plugins.local.php', "\$plugins['{$entry}'] = 0;\n");
    }
}
$dh->close();
// load dw
require_once DOKU_INC . 'inc/init.php';
// load the parser so $PARSER_MODES is defined before the tests start
// otherwise PHPUnit unsets $PARSER_MODES in some cases which breaks p_get_parsermodes()
require_once DOKU_INC . 'inc/parser/parser.php';