summaryrefslogtreecommitdiff
path: root/trunk/reprap/web/james-bom/MDB2/MDB2-2.4.1/tests/test_setup.php.dist
blob: 35980bd2eb964eceaceede52a336b3d6bb3d5c69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php

// uncomment this line if you want to run both MDB2 from a CVS checkout
#ini_set('include_path', '..'.PATH_SEPARATOR.ini_get('include_path'));

$testcases = array(
    'MDB2_api_testcase',
    'MDB2_usage_testcase',
    'MDB2_bugs_testcase',
    'MDB2_extended_testcase',
    'MDB2_datatype_testcase',
    'MDB2_manager_testcase',
    'MDB2_reverse_testcase',
    'MDB2_function_testcase',
    'MDB2_native_testcase',
    'MDB2_internals_testcase',
);

// use a user that has full permissions on a database named "driver_test"
$mysql = array(
    'dsn' => array(
        'phptype' => 'mysql',
        'username' => 'username',
        'password' => 'password',
        'hostspec' => 'hostname',
    ),
    'options' => array(
        'use_transactions' => true
    )
);

$pgsql = array(
    'dsn' => array(
        'phptype' => 'pgsql',
        'username' => 'username',
        'password' => 'password',
        'hostspec' => 'hostname',
    )
);

$oci8 = array(
    'dsn' => array(
        'phptype' => 'oci8',
        'username' => '',
        'password' => 'password',
        'hostspec' => 'hostname',
    ),
    'options' => array(
        'DBA_username' => 'username',
        'DBA_password' => 'password'
    )
);

$sqlite = array(
    'dsn' => array(
        'phptype' => 'sqlite',
        'username' => '',
        'password' => 'password',
        'hostspec' => 'hostname',
    ),
    'options' => array(
        'database_path' => '',
        'database_extension' => '',
    )
);

// must be a user with system administrator privileges
$mssql = array(
    'dsn' => array(
        'phptype' => 'mssql',
        'username' => 'username',
        'password' => 'password',
        'hostspec' => 'hostname',
    )
);

$fbsql = array(
    'dsn' => array(
        'phptype' => 'fbsql',
        'username' => 'username',
        'password' => 'password',
        'hostspec' => 'hostname',
    )
);


$ibase = array(
    'dsn' => array(
        'phptype' => 'ibase',
        'username' => 'username',
        'password' => 'password',
        'hostspec' => 'hostname',
    )
);

$dbarray = array();
#$dbarray[] = $mysql;
#$dbarray[] = $pgsql;
#$dbarray[] = $oci8;
#$dbarray[] = $sqlite;
#$dbarray[] = $mssql;
#$dbarray[] = $fbsql;
#$dbarray[] = $ibase;

// you may need to uncomment the line and modify the multiplier as you see fit
#set_time_limit(60*count($dbarray));

//if uncommented, the following will drop and recreate the test database when running the test
// the paths assumes that MDB2_Schema is checked out in the same parent directory as MDB2
/*
require_once('MDB2/Schema.php');
$schema_path = '../../MDB2_Schema/tests/';

function pe($e) {
    die($e->getMessage().' '.$e->getUserInfo());
}
PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
foreach ($dbarray as $dbtype) {
    // Work around oci8 problems with dropping the connected user
    $dsn = $dbtype['dsn'];
    if ($dbtype['dsn']['phptype'] == 'oci8') {
        $dsn['username'] = $dbtype['options']['DBA_username'];
        $dsn['password'] = $dbtype['options']['DBA_password'];
        $dsn['database'] = $dbtype['options']['DBA_username'];
    }
    $db =& MDB2::connect($dsn, $dbtype['options']);
    $db->loadModule('Manager');
    if (in_array('driver_test', $db->manager->listDatabases())) {
        $db->manager->dropDatabase('driver_test');
    }
    // Work around oci8 problems with dropping the connected user
    if ($dbtype['dsn']['phptype'] == 'oci8') {
        $db->query('CREATE USER '.$dbtype['dsn']['username'].' IDENTIFIED BY '.$dbtype['dsn']['password'].' DEFAULT TABLESPACE USERS QUOTA UNLIMITED ON USERS');
        $db->query('GRANT CREATE SESSION, CREATE TABLE, CREATE SEQUENCE, CREATE TRIGGER to '.$dbtype['dsn']['username']);
    }
    $schema =& MDB2_Schema::factory($dbtype['dsn'], $dbtype['options']);
    $schema->updateDatabase(
                            '../../MDB2_Schema/tests/driver_test.schema',
                            false,
                            array('create' => '1', 'name' => 'driver_test')
                            );
    $schema->updateDatabase(
                            '../../MDB2_Schema/tests/lob_test.schema',
                            false,
                            array('create' => '1', 'name' => 'driver_test')
                            );
}
PEAR::popErrorHandling();
*/

?>