示例#1
0
function prepareTestDatabase()
{
    $dev_ini = parse_ini_file(PROJECT_ROOT . '/inc/config.ini', true);
    $test_ini = parse_ini_file(PROJECT_ROOT . '/inc/config.test.ini', true);
    // TODO: move this TEST_URL_BASE config somewhere else
    if (@$test_ini['TEST_URL_BASE'] != null) {
        $GLOBALS['TEST_URL_BASE'] = $test_ini['TEST_URL_BASE'];
    } else {
        echo "** TEST_URL_BASE is not set, using localhost \n";
        $GLOBALS['TEST_URL_BASE'] = 'localhost';
    }
    if ($dev_ini['ENV'] != 'development') {
        throw new Exception('Source config must be development');
    }
    if ($test_ini['ENV'] != 'test') {
        throw new Exception('Destination config must be test');
    }
    if ($dev_ini['development']['DB_DATABASE'] == $test_ini['test']['DB_DATABASE']) {
        throw new Exception("Development database and test database cannot have the same name");
    }
    $testDatabase = new SchemaCopy($test_ini['test']);
    $devDatabase = new SchemaCopy($dev_ini['development']);
    prepareTestSchema($testDatabase, $devDatabase);
    loadSeedData($testDatabase);
}
示例#2
0
function prepareTestDatabase()
{
    $config = parse_ini_file(PROJECT_ROOT . '/inc/config.ini', true);
    $testDatabase = new SchemaCopy($config['test']);
    $devDatabase = new SchemaCopy($config['development']);
    prepareTestSchema($testDatabase, $devDatabase);
    loadSeedData($testDatabase);
}