Example #1
0
 public function testMigrateUp()
 {
     $m = new Pluf_Migration();
     $m->dry_run = true;
     $this->assertEquals(true, $m->migrate(5));
 }
Example #2
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 #3
0
    $db =& Pluf::db();
    $db->setSearchPath($search_path);
    debug('Set search path to: ' . $search_path);
}
$app = null;
// Migrate all the applications.
$app_disp = 'all the apps';
$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;
    }