Example #1
0
    exit(1);
}
define('SIMPLE_TEST', $simple_test . '/');
require_once SIMPLE_TEST . 'unit_tester.php';
require_once SIMPLE_TEST . 'reporter.php';
$files = getTestFiles($testfolder);
$dirs = getTestDirs($testfolder);
foreach ($dirs as $dir) {
    foreach (getTestFiles($dir) as $test) {
        $files[] = $test;
    }
}
$test =& new GroupTest(sprintf('All tests for application %s.', $app));
foreach ($files as $t) {
    if (!function_exists('apc_store') && 'Pluf_Tests_Cache_Apc' === $t[1]) {
        continue;
    }
    $test->addTestCase(new $t[1]());
}
$reporter = new TextReporter();
$mig = new Pluf_Migration(null);
$mig->display = false;
$mig->install();
// If available, load an initialisation file.
if (file_exists($app . '/Tests/init.json')) {
    $created = Pluf_Test_Fixture::loadFile($app . '/Tests/init.json');
} else {
    $created = array();
}
$test->run($reporter);
$mig->unInstall();
Example #2
0
$v_disp = 'latest';
if (!is_null($what['version'])) {
    $v_disp = $what['version'];
}
if ($what['app']) {
    $app = trim($what['app']);
    $app_disp = $app;
}
$m = new Pluf_Migration($app);
if ($debug) {
    $m->display = true;
}
$m->dry_run = $what['dry_run'];
if ($what['install']) {
    debug('Install ' . $app_disp);
    $m->install();
} elseif ($what['un-install']) {
    debug('Uninstall ' . $app_disp);
    $m->unInstall();
} elseif ($what['backup']) {
    debug('Backup ' . $app_disp);
    if (!isset($args[1])) {
        $args[1] = null;
    }
    $m->backup($args[0], $args[1]);
} elseif ($what['restore']) {
    debug('Restore ' . $app_disp);
    $m->restore($args[0], $args[1]);
} else {
    debug('Migrate ' . $app . ' to version ' . $v_disp);
    $m->migrate($what['version']);