1
|
|
|
<?php
|
2
|
|
|
/**
|
3
|
|
|
* Function area: Schemas
|
4
|
|
|
* Subfunction area: Table
|
5
|
|
|
* @author Augmentum SpikeSource Team
|
6
|
|
|
* @copyright 2005 by Augmentum, Inc.
|
7
|
|
|
*/
|
8
|
|
|
|
9
|
|
|
// Import the precondition class.
|
10
|
|
|
if(is_dir('../Public')) {
|
11
|
|
|
require_once('../Public/SetPrecondition.php');
|
12
|
|
|
}
|
13
|
|
|
|
14
|
|
|
|
15
|
|
|
/**
|
16
|
|
|
* A test case suite for testing TABLE feature in phpPgAdmin, including
|
17
|
|
|
* cases for testing table DDL and DML operations.
|
18
|
|
|
*/
|
19
|
|
|
class TableTest extends PreconditionSet
|
20
|
|
|
{
|
21
|
|
|
/**
|
22
|
|
|
* Set up the preconditon.
|
23
|
|
|
*/
|
24
|
|
|
function setUp()
|
25
|
|
|
{
|
26
|
|
|
global $webUrl;
|
27
|
|
|
global $SUPER_USER_NAME;
|
28
|
|
|
global $SUPER_USER_PASSWORD;
|
29
|
|
|
|
30
|
|
|
$this->login($SUPER_USER_NAME, $SUPER_USER_PASSWORD,
|
31
|
|
|
"$webUrl/login.php");
|
32
|
|
|
|
33
|
|
|
return TRUE;
|
34
|
|
|
}
|
35
|
|
|
|
36
|
|
|
|
37
|
|
|
/**
|
38
|
|
|
* Clean up all the result.
|
39
|
|
|
*/
|
40
|
|
|
function tearDown()
|
41
|
|
|
{
|
42
|
|
|
// Logout from the system.
|
43
|
|
|
$this->logout();
|
44
|
|
|
|
45
|
|
|
return TRUE;
|
46
|
|
|
}
|
47
|
|
|
|
48
|
|
|
|
49
|
|
|
/**
|
50
|
|
|
* TestCaseID: HCT01
|
51
|
|
|
* This testcase is used to create a table in an existing database.
|
52
|
|
|
*/
|
53
|
|
|
function testCreateTable()
|
54
|
|
|
{
|
55
|
|
|
global $webUrl;
|
56
|
|
|
global $lang, $SERVER, $DATABASE;
|
57
|
|
|
|
58
|
|
|
// Turn to the create table page to create a table.
|
59
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
60
|
|
|
'server' => $SERVER,
|
61
|
|
|
'action' => 'create',
|
62
|
|
|
'database' => $DATABASE,
|
63
|
|
|
'schema' => 'public'))
|
64
|
|
|
);
|
65
|
|
|
|
66
|
|
|
// Enter the table name and field number.
|
67
|
|
|
$this->assertTrue($this->setField('name', 'newtable'));
|
68
|
|
|
$this->assertTrue($this->setField('fields', '2'));
|
69
|
|
|
$this->assertTrue($this->setField('spcname', 'pg_default'));
|
70
|
|
|
$this->assertTrue($this->setField('tblcomment', 'Create from SimpleTest!'));
|
71
|
|
|
|
72
|
|
|
// Click the button "next >" for entering the detail information.
|
73
|
|
|
//$this->assertTrue($this->clickSubmit($lang['strnext']));
|
74
|
|
|
// If we do not hardcoded it here, it will cause fail. Encoding issue.
|
75
|
|
|
$this->assertTrue($this->clickSubmit('Next >'));
|
76
|
|
|
|
77
|
|
|
// Enter the detail information of the table.
|
78
|
|
|
$this->assertTrue($this->setField('field[0]', 'firstfield'));
|
79
|
|
|
$this->assertTrue($this->setField('type[0]', 'text'));
|
80
|
|
|
$this->assertTrue($this->setField('array[0]', ''));
|
81
|
|
|
|
82
|
|
|
$this->assertTrue($this->setField('field[1]', 'secondfield'));
|
83
|
|
|
$this->assertTrue($this->setField('type[1]', 'text'));
|
84
|
|
|
$this->assertTrue($this->setField('array[1]', ''));
|
85
|
|
|
|
86
|
|
|
// Click the button "Create" for creating the table
|
87
|
|
|
$this->assertTrue($this->clickSubmit($lang['strcreate']));
|
88
|
|
|
|
89
|
|
|
// Verify whether the table is created correctly.
|
90
|
|
|
$this->assertTrue($this->assertWantedText($lang['strtablecreated']));
|
91
|
|
|
|
92
|
|
|
// Drop the table which is created in the testcase.
|
93
|
|
|
$this->dropTable($DATABASE, 'newtable', 'public');
|
94
|
|
|
|
95
|
|
|
return TRUE;
|
96
|
|
|
}
|
97
|
|
|
|
98
|
|
|
|
99
|
|
|
/**
|
100
|
|
|
* TestCaseID: HCT02
|
101
|
|
|
* Create a table with the wrong field number.
|
102
|
|
|
*/
|
103
|
|
|
function testCreateTableWithBadFieldNumber()
|
104
|
|
|
{
|
105
|
|
|
global $webUrl;
|
106
|
|
|
global $lang, $SERVER, $DATABASE;
|
107
|
|
|
|
108
|
|
|
// Turn to the create table page to create a table.
|
109
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
110
|
|
|
'server' => $SERVER,
|
111
|
|
|
'action' => 'create',
|
112
|
|
|
'database' => $DATABASE,
|
113
|
|
|
'schema' => 'public'))
|
114
|
|
|
);
|
115
|
|
|
|
116
|
|
|
// Enter no name.
|
117
|
|
|
//$this->assertTrue($this->clickSubmit($lang['strnext']));
|
118
|
|
|
// If we do not hardcoded it here, it will cause fail. Encoding issue.
|
119
|
|
|
$this->assertTrue($this->clickSubmit('Next >'));
|
120
|
|
|
$this->assertTrue($this->assertWantedText($lang['strtableneedsname']));
|
121
|
|
|
|
122
|
|
|
// Enter the table name and field number.
|
123
|
|
|
$this->assertTrue($this->setField('name', 'badtable'));
|
124
|
|
|
|
125
|
|
|
// Enter no name.
|
126
|
|
|
//$this->assertTrue($this->clickSubmit($lang['strnext']));
|
127
|
|
|
// If we do not hardcoded it here, it will cause fail. Encoding issue.
|
128
|
|
|
$this->assertTrue($this->clickSubmit('Next >'));
|
129
|
|
|
$this->assertTrue($this->assertWantedText($lang['strtableneedscols']));
|
130
|
|
|
|
131
|
|
|
// Enter illegal field number.
|
132
|
|
|
$this->assertTrue($this->setField('fields', 'illegalnumber'));
|
133
|
|
|
$this->assertTrue($this->setField('tblcomment', 'Wrong field number.'));
|
134
|
|
|
|
135
|
|
|
// Click the button "next >" for entering the detail information.
|
136
|
|
|
//$this->assertTrue($this->clickSubmit($lang['strnext']));
|
137
|
|
|
// If we do not hardcoded it here, it will cause fail. Encoding issue.
|
138
|
|
|
$this->assertTrue($this->clickSubmit('Next >'));
|
139
|
|
|
|
140
|
|
|
//Verify whether the table creation fialed.
|
141
|
|
|
$this->assertTrue($this->assertWantedText($lang['strtableneedscols']));
|
142
|
|
|
|
143
|
|
|
return TRUE;
|
144
|
|
|
}
|
145
|
|
|
|
146
|
|
|
|
147
|
|
|
/**
|
148
|
|
|
* TestCaseID: HCT03
|
149
|
|
|
* Create a table with the wrong field information.
|
150
|
|
|
*/
|
151
|
|
|
function testCreateTableWithBadFieldData()
|
152
|
|
|
{
|
153
|
|
|
global $webUrl;
|
154
|
|
|
global $lang, $SERVER, $DATABASE;
|
155
|
|
|
|
156
|
|
|
// Turn to the create table page to create a table.
|
157
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
158
|
|
|
'server' => $SERVER,
|
159
|
|
|
'action' => 'create',
|
160
|
|
|
'database' => $DATABASE,
|
161
|
|
|
'schema' => 'public'))
|
162
|
|
|
);
|
163
|
|
|
|
164
|
|
|
// Enter the table name and field number.
|
165
|
|
|
$this->assertTrue($this->setField('name', 'badfield'));
|
166
|
|
|
$this->assertTrue($this->setField('fields', '2'));
|
167
|
|
|
$this->assertTrue($this->setField('spcname', 'pg_default'));
|
168
|
|
|
$this->assertTrue($this->setField('tblcomment', 'With illegal field information!'));
|
169
|
|
|
|
170
|
|
|
// Click the button "next >" for entering the detail information.
|
171
|
|
|
//$this->assertTrue($this->clickSubmit($lang['strnext']));
|
172
|
|
|
// If we do not hardcoded it here, it will cause fail. Encoding issue.
|
173
|
|
|
$this->assertTrue($this->clickSubmit('Next >'));
|
174
|
|
|
|
175
|
|
|
// Enter the detail information of the table.
|
176
|
|
|
$this->assertTrue($this->setField('field[0]', 'field1'));
|
177
|
|
|
$this->assertTrue($this->setField('type[0]', 'integer'));
|
178
|
|
|
$this->assertTrue($this->setField('array[0]', '[ ]'));
|
179
|
|
|
$this->assertTrue($this->setField('default[0]', '100'));
|
180
|
|
|
|
181
|
|
|
$this->assertTrue($this->setField('field[1]', 'field2'));
|
182
|
|
|
$this->assertTrue($this->setField('type[1]', 'integer'));
|
183
|
|
|
$this->assertTrue($this->setField('array[1]', '[ ]'));
|
184
|
|
|
$this->assertTrue($this->setField('default[0]', 'testcase'));
|
185
|
|
|
|
186
|
|
|
// Click the button "Create" for creating the table
|
187
|
|
|
$this->assertTrue($this->clickSubmit($lang['strcreate']));
|
188
|
|
|
|
189
|
|
|
//Verify whether the table creation failed.
|
190
|
|
|
$this->assertTrue($this->assertWantedText($lang['strtableneedsfield']));
|
191
|
|
|
|
192
|
|
|
return TRUE;
|
193
|
|
|
}
|
194
|
|
|
|
195
|
|
|
|
196
|
|
|
/**
|
197
|
|
|
* TestCaseID: HIT01
|
198
|
|
|
* Insert a row into an existing table
|
199
|
|
|
*/
|
200
|
|
|
function testInsertOneRow()
|
201
|
|
|
{
|
202
|
|
|
global $webUrl;
|
203
|
|
|
global $lang, $SERVER,$DATABASE;
|
204
|
|
|
|
205
|
|
|
// Create a table.
|
206
|
|
|
$this->createTable($DATABASE, 'public', 'viewtest', '3');
|
207
|
|
|
|
208
|
|
|
// Turn to the "Insert row" interface.
|
209
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
210
|
|
|
'server' => $SERVER,
|
211
|
|
|
'action' => 'confinsertrow',
|
212
|
|
|
'database' => $DATABASE,
|
213
|
|
|
'schema' => 'public',
|
214
|
|
|
'table' => 'viewtest'))
|
215
|
|
|
);
|
216
|
|
|
|
217
|
|
|
// Set the value of the fields.
|
218
|
|
|
$this->assertTrue($this->setField('values[field0]', 'row1column1'));
|
219
|
|
|
$this->assertTrue($this->setField('values[field1]', 'row1column2'));
|
220
|
|
|
$this->assertTrue($this->setField('values[field2]', 'row1column3'));
|
221
|
|
|
|
222
|
|
|
// Click the "Insert" button to insert a row.
|
223
|
|
|
$this->assertTrue($this->clickSubmit($lang['strinsert']));
|
224
|
|
|
// Verify whether the row is inserted successfully.
|
225
|
|
|
$this->assertTrue($this->assertWantedText($lang['strrowinserted']));
|
226
|
|
|
|
227
|
|
|
return TRUE;
|
228
|
|
|
}
|
229
|
|
|
|
230
|
|
|
|
231
|
|
|
/**
|
232
|
|
|
* TestCaseID: HIT02
|
233
|
|
|
* Insert two rows into an existing table
|
234
|
|
|
*/
|
235
|
|
|
function testInsertTwoRows()
|
236
|
|
|
{
|
237
|
|
|
global $webUrl;
|
238
|
|
|
global $lang, $SERVER, $DATABASE;
|
239
|
|
|
|
240
|
|
|
// Turn to the "Insert row" interface.
|
241
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
242
|
|
|
'server' => $SERVER,
|
243
|
|
|
'action' => 'confinsertrow',
|
244
|
|
|
'database' => $DATABASE,
|
245
|
|
|
'schema' => 'public',
|
246
|
|
|
'table' => 'viewtest'))
|
247
|
|
|
);
|
248
|
|
|
|
249
|
|
|
// Set the value of the fields.
|
250
|
|
|
$this->assertTrue($this->setField('values[field0]', 'row2column1'));
|
251
|
|
|
$this->assertTrue($this->setField('values[field1]', 'row2column2'));
|
252
|
|
|
$this->assertTrue($this->setField('values[field2]', 'row2column3'));
|
253
|
|
|
|
254
|
|
|
// Click the "Insert & Repeat" button to insert a row.
|
255
|
|
|
//$this->assertTrue($this->clickSubmit($lang['strinsertandrepeat']));
|
256
|
|
|
// If we do not hardcoded it here, it will cause fail. Encoding issue.
|
257
|
|
|
$this->assertTrue($this->clickSubmit('Insert & Repeat'));
|
258
|
|
|
// Verify whether the row is inserted successfully.
|
259
|
|
|
$this->assertTrue($this->assertWantedText($lang['strrowinserted']));
|
260
|
|
|
|
261
|
|
|
// Set the value of the fields again.
|
262
|
|
|
$this->assertTrue($this->setField('values[field0]', 'row3column1'));
|
263
|
|
|
$this->assertTrue($this->setField('values[field1]', 'row3column2'));
|
264
|
|
|
$this->assertTrue($this->setField('values[field2]', 'row3column3'));
|
265
|
|
|
|
266
|
|
|
// Click the "Insert" button to insert a row.
|
267
|
|
|
$this->assertTrue($this->clickSubmit($lang['strinsert']));
|
268
|
|
|
// Verify whether the row is inserted successfully.
|
269
|
|
|
$this->assertTrue($this->assertWantedText($lang['strrowinserted']));
|
270
|
|
|
|
271
|
|
|
return TRUE;
|
272
|
|
|
}
|
273
|
|
|
|
274
|
|
|
|
275
|
|
|
/**
|
276
|
|
|
* TestCaseID: HIT03
|
277
|
|
|
* Insert one row with illegal data type into an existing table.
|
278
|
|
|
*/
|
279
|
|
|
function testInsertWithBadData()
|
280
|
|
|
{
|
281
|
|
|
global $webUrl;
|
282
|
|
|
global $lang, $SERVER, $DATABASE;
|
283
|
|
|
|
284
|
|
|
// Turn to the "Insert row" interface.
|
285
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
286
|
|
|
'server' => $SERVER,
|
287
|
|
|
'action' => 'confinsertrow',
|
288
|
|
|
'database' => $DATABASE,
|
289
|
|
|
'schema' => 'public',
|
290
|
|
|
'table' => 'viewtest'))
|
291
|
|
|
);
|
292
|
|
|
|
293
|
|
|
// Set the value of the fields.
|
294
|
|
|
$this->assertTrue($this->setField('format[field0]', 'Expression'));
|
295
|
|
|
$this->assertTrue($this->setField('format[field1]', 'Expression'));
|
296
|
|
|
$this->assertTrue($this->setField('format[field2]', 'Expression'));
|
297
|
|
|
|
298
|
|
|
$this->assertTrue($this->setField('values[field0]', 'row0column1'));
|
299
|
|
|
$this->assertTrue($this->setField('values[field1]', 'row0column2'));
|
300
|
|
|
$this->assertTrue($this->setField('values[field2]', 'row0column3'));
|
301
|
|
|
|
302
|
|
|
// Click the "Insert" button to insert a row.
|
303
|
|
|
$this->assertTrue($this->clickSubmit($lang['strinsert']));
|
304
|
|
|
// Verify whether the row insertion failed.
|
305
|
|
|
$this->assertTrue($this->assertWantedText($lang['strrowinsertedbad']));
|
306
|
|
|
|
307
|
|
|
return TRUE;
|
308
|
|
|
}
|
309
|
|
|
|
310
|
|
|
|
311
|
|
|
/**
|
312
|
|
|
* TestCaseID: HER01
|
313
|
|
|
* Edit a row.
|
314
|
|
|
* XXX Fail cause we have no index on viewtest, created by $this->createable
|
315
|
|
|
* see Public/SetPrecondition.php
|
316
|
|
|
*/
|
317
|
|
|
function testEditRow()
|
318
|
|
|
{
|
319
|
|
|
global $webUrl;
|
320
|
|
|
global $lang, $SERVER, $DATABASE;
|
321
|
|
|
|
322
|
|
|
// Turn to the "Tables" interface.
|
323
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
324
|
|
|
'server' => $SERVER,
|
325
|
|
|
'database' => $DATABASE,
|
326
|
|
|
'schema' => 'public'))
|
327
|
|
|
);
|
328
|
|
|
// Select the table "viewtest".
|
329
|
|
|
$this->assertTrue($this->clickLink('viewtest'));
|
330
|
|
|
// Browse the table.
|
331
|
|
|
$this->assertTrue($this->clickLink($lang['strbrowse']));
|
332
|
|
|
// Select a row.
|
333
|
|
|
$this->assertTrue($this->clickLink($lang['stredit']));
|
334
|
|
|
|
335
|
|
|
// Edit the row.
|
336
|
|
|
$this->assertTrue($this->setField('values[field0]', 'updatecolumn0'));
|
337
|
|
|
$this->assertTrue($this->setField('values[field1]', 'updatecolumn1'));
|
338
|
|
|
$this->assertTrue($this->setField('values[field2]', 'updatecolumn2'));
|
339
|
|
|
|
340
|
|
|
// Click the "Save" button and save the edits.
|
341
|
|
|
$this->assertTrue($this->clickSubmit($lang['strsave']));
|
342
|
|
|
// Verify whether the edit is done successfully.
|
343
|
|
|
$this->assertTrue($this->assertWantedText('updatecolumn0'));
|
344
|
|
|
|
345
|
|
|
return TRUE;
|
346
|
|
|
}
|
347
|
|
|
|
348
|
|
|
|
349
|
|
|
/**
|
350
|
|
|
* TestCaseID: HDR01
|
351
|
|
|
* Delete a row.
|
352
|
|
|
* XXX Fail, see comment on testEditRow
|
353
|
|
|
*/
|
354
|
|
|
function testDeleteRow()
|
355
|
|
|
{
|
356
|
|
|
global $webUrl;
|
357
|
|
|
global $lang, $SERVER, $DATABASE;
|
358
|
|
|
|
359
|
|
|
// Turn to the "Tables" interface.
|
360
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
361
|
|
|
'server' => $SERVER,
|
362
|
|
|
'database' => $DATABASE,
|
363
|
|
|
'schema' => 'public'))
|
364
|
|
|
);
|
365
|
|
|
// Select the table "viewtest".
|
366
|
|
|
$this->assertTrue($this->clickLink('viewtest'));
|
367
|
|
|
// Browse the table.
|
368
|
|
|
$this->assertTrue($this->clickLink($lang['strbrowse']));
|
369
|
|
|
// Delete a row.
|
370
|
|
|
$this->assertTrue($this->clickLink($lang['strdelete']));
|
371
|
|
|
|
372
|
|
|
// Click the "Yes" button and delete the edits.
|
373
|
|
|
$this->assertTrue($this->clickSubmit($lang['stryes']));
|
374
|
|
|
|
375
|
|
|
return TRUE;
|
376
|
|
|
}
|
377
|
|
|
|
378
|
|
|
|
379
|
|
|
/**
|
380
|
|
|
* TestCaseID: HBT01
|
381
|
|
|
* Browse an existing table.
|
382
|
|
|
*/
|
383
|
|
|
function testBrowseTable()
|
384
|
|
|
{
|
385
|
|
|
global $webUrl;
|
386
|
|
|
global $lang, $SERVER, $DATABASE;
|
387
|
|
|
|
388
|
|
|
// Turn to the "Browse table" interface.
|
389
|
|
|
$this->assertTrue($this->get("$webUrl/display.php", array(
|
390
|
|
|
'server' => $SERVER,
|
391
|
|
|
'database' => $DATABASE,
|
392
|
|
|
'schema' => 'public',
|
393
|
|
|
'subject' => 'table',
|
394
|
|
|
'return_url' => 'tables.php%3Fdatabase%3Dtest%26amp%3Bschema%3Dpublic',
|
395
|
|
|
'return_desc' => 'Back',
|
396
|
|
|
'table' => 'viewtest'))
|
397
|
|
|
);
|
398
|
|
|
|
399
|
|
|
// Verify whether the rows are displayed.
|
400
|
|
|
$this->assertTrue($this->assertWantedText($lang['strrows']));
|
401
|
|
|
|
402
|
|
|
// Click the links in the display page.
|
403
|
|
|
$this->assertTrue($this->clickLink('field0'));
|
404
|
|
|
$this->assertTrue($this->clickLink('field1'));
|
405
|
|
|
$this->assertTrue($this->clickLink($lang['strexpand']));
|
406
|
|
|
$this->assertTrue($this->clickLink($lang['strcollapse']));
|
407
|
|
|
$this->assertTrue($this->clickLink($lang['strrefresh']));
|
408
|
|
|
$this->assertTrue($this->clickLink($lang['strback']));
|
409
|
|
|
|
410
|
|
|
return TRUE;
|
411
|
|
|
}
|
412
|
|
|
|
413
|
|
|
|
414
|
|
|
/**
|
415
|
|
|
* TestCaseID: HST01
|
416
|
|
|
* Select all the rows of the table.
|
417
|
|
|
*/
|
418
|
|
|
function testSelectAll()
|
419
|
|
|
{
|
420
|
|
|
global $webUrl;
|
421
|
|
|
global $lang, $SERVER, $DATABASE;
|
422
|
|
|
|
423
|
|
|
// Turn to the "tables" page.
|
424
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
425
|
|
|
'server' => $SERVER,
|
426
|
|
|
'database' => $DATABASE,
|
427
|
|
|
'schema' => 'public',
|
428
|
|
|
'subject' => 'schema'))
|
429
|
|
|
);
|
430
|
|
|
$this->assertTrue($this->clickLink('viewtest'));
|
431
|
|
|
|
432
|
|
|
// Select all the rows.
|
433
|
|
|
$this->assertTrue($this->clickLink($lang['strselect']));
|
434
|
|
|
$this->assertTrue($this->setField('show[field0]', TRUE));
|
435
|
|
|
$this->assertTrue($this->setField('show[field1]', TRUE));
|
436
|
|
|
$this->assertTrue($this->setField('show[field2]', TRUE));
|
437
|
|
|
|
438
|
|
|
// Display all the rows.
|
439
|
|
|
$this->assertTrue($this->clickSubmit($lang['strselect']));
|
440
|
|
|
// Verify whether select successful.
|
441
|
|
|
$this->assertTrue($this->assertWantedText('row'));
|
442
|
|
|
|
443
|
|
|
return TRUE;
|
444
|
|
|
}
|
445
|
|
|
|
446
|
|
|
/**
|
447
|
|
|
* TestCaseID: HST02
|
448
|
|
|
* Select rows according to the query conditions.
|
449
|
|
|
*/
|
450
|
|
|
function testSelectByConditions()
|
451
|
|
|
{
|
452
|
|
|
global $webUrl;
|
453
|
|
|
global $lang, $SERVER, $DATABASE;
|
454
|
|
|
|
455
|
|
|
// Turn to the "tables" page.
|
456
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
457
|
|
|
'server' => $SERVER,
|
458
|
|
|
'action' => 'confselectrows',
|
459
|
|
|
'database' => $DATABASE,
|
460
|
|
|
'schema' => 'public',
|
461
|
|
|
'table' => 'viewtest'))
|
462
|
|
|
);
|
463
|
|
|
|
464
|
|
|
// Display all columns.
|
465
|
|
|
$this->assertTrue($this->setField('show[field0]', TRUE));
|
466
|
|
|
$this->assertTrue($this->setField('show[field1]', TRUE));
|
467
|
|
|
$this->assertTrue($this->setField('show[field2]', TRUE));
|
468
|
|
|
// Enter the query conditions.
|
469
|
|
|
$this->assertTrue($this->setField('values[field0]', 'row2column1'));
|
470
|
|
|
$this->assertTrue($this->setField('values[field1]', 'row2column2'));
|
471
|
|
|
$this->assertTrue($this->setField('values[field2]', 'row2column3'));
|
472
|
|
|
|
473
|
|
|
// Click the "Select" button.
|
474
|
|
|
$this->assertTrue($this->clickSubmit($lang['strselect']));
|
475
|
|
|
// Verify whether select successful.
|
476
|
|
|
$this->assertTrue($this->assertWantedText('row'));
|
477
|
|
|
return TRUE;
|
478
|
|
|
}
|
479
|
|
|
|
480
|
|
|
/**
|
481
|
|
|
* TestCaseID: HST03
|
482
|
|
|
* Select data from an existing table with no row display.
|
483
|
|
|
*/
|
484
|
|
|
function testSelectTableNoRowDisplay()
|
485
|
|
|
{
|
486
|
|
|
global $webUrl;
|
487
|
|
|
global $lang, $SERVER, $DATABASE;
|
488
|
|
|
|
489
|
|
|
// Turn to the "tables" page.
|
490
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
491
|
|
|
'server' => $SERVER,
|
492
|
|
|
'action' => 'confselectrows',
|
493
|
|
|
'database' => $DATABASE,
|
494
|
|
|
'schema' => 'public',
|
495
|
|
|
'table' => 'viewtest'))
|
496
|
|
|
);
|
497
|
|
|
|
498
|
|
|
// Enter the query conditions.
|
499
|
|
|
$this->assertTrue($this->setField('values[field0]', 'row2column1'));
|
500
|
|
|
$this->assertTrue($this->setField('values[field1]', 'row2column2'));
|
501
|
|
|
$this->assertTrue($this->setField('values[field2]', 'row2column3'));
|
502
|
|
|
|
503
|
|
|
// Click the "Select" button.
|
504
|
|
|
$this->assertTrue($this->clickSubmit($lang['strselect']));
|
505
|
|
|
// Verify whether select successful.
|
506
|
|
|
$this->assertTrue($this->assertWantedText($lang['strselectneedscol']));
|
507
|
|
|
|
508
|
|
|
return TRUE;
|
509
|
|
|
}
|
510
|
|
|
|
511
|
|
|
|
512
|
|
|
/**
|
513
|
|
|
* TestCaseID: HVT01
|
514
|
|
|
* Vacuum an existing table with the check box "Full" and "Analyze" unchecked.
|
515
|
|
|
*/
|
516
|
|
|
function testVacuumUnchecked()
|
517
|
|
|
{
|
518
|
|
|
global $webUrl;
|
519
|
|
|
global $lang, $SERVER, $DATABASE;
|
520
|
|
|
|
521
|
|
|
// Turn to the "Vacuum" page.
|
522
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
523
|
|
|
'server' => $SERVER,
|
524
|
|
|
'action' => 'confirm_vacuum',
|
525
|
|
|
'database' => $DATABASE,
|
526
|
|
|
'schema' => 'public',
|
527
|
|
|
'table' => 'viewtest'))
|
528
|
|
|
);
|
529
|
|
|
|
530
|
|
|
// Click the "Vacuum" button.
|
531
|
|
|
$this->assertTrue($this->clickSubmit($lang['strvacuum']));
|
532
|
|
|
// Verify whether vacuum successfully.
|
533
|
|
|
$this->assertTrue($this->assertWantedText($lang['strvacuumgood']));
|
534
|
|
|
|
535
|
|
|
return TRUE;
|
536
|
|
|
}
|
537
|
|
|
|
538
|
|
|
|
539
|
|
|
/**
|
540
|
|
|
* TestCaseID: HVT02
|
541
|
|
|
* Vacuum an existing table with the check box "Full" and "Analyze" checked.
|
542
|
|
|
*/
|
543
|
|
|
function testVacuumChecked()
|
544
|
|
|
{
|
545
|
|
|
global $webUrl;
|
546
|
|
|
global $lang, $SERVER, $DATABASE;
|
547
|
|
|
|
548
|
|
|
// Turn to the "Vacuum" page.
|
549
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
550
|
|
|
'server' => $SERVER,
|
551
|
|
|
'action' => 'confirm_vacuum',
|
552
|
|
|
'database' => $DATABASE,
|
553
|
|
|
'schema' => 'public',
|
554
|
|
|
'table' => 'viewtest'))
|
555
|
|
|
);
|
556
|
|
|
|
557
|
|
|
// Make sure the check box "Full" and "Analyze" are checked
|
558
|
|
|
$this->assertTrue($this->setField('vacuum_full', TRUE));
|
559
|
|
|
$this->assertTrue($this->setField('vacuum_analyze', TRUE));
|
560
|
|
|
|
561
|
|
|
// Click the "Vacuum" button.
|
562
|
|
|
$this->assertTrue($this->clickSubmit($lang['strvacuum']));
|
563
|
|
|
// Verify whether vacuum successfully.
|
564
|
|
|
$this->assertTrue($this->assertWantedText($lang['strvacuumgood']));
|
565
|
|
|
|
566
|
|
|
return TRUE;
|
567
|
|
|
}
|
568
|
|
|
|
569
|
|
|
|
570
|
|
|
/**
|
571
|
|
|
* TestCaseID: HET01
|
572
|
|
|
* Empty an existing table.
|
573
|
|
|
*/
|
574
|
|
|
function testEmptyTable()
|
575
|
|
|
{
|
576
|
|
|
global $webUrl;
|
577
|
|
|
global $lang, $SERVER, $DATABASE;
|
578
|
|
|
|
579
|
|
|
// Turn to the "tables" page.
|
580
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
581
|
|
|
'server' => $SERVER,
|
582
|
|
|
'database' => $DATABASE,
|
583
|
|
|
'schema' => 'public',
|
584
|
|
|
'subject' => 'schema'))
|
585
|
|
|
);
|
586
|
|
|
|
587
|
|
|
// Empty a table.
|
588
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
589
|
|
|
'server' => $SERVER,
|
590
|
|
|
'action' => 'confirm_empty',
|
591
|
|
|
'database' => $DATABASE,
|
592
|
|
|
'schema' => 'public',
|
593
|
|
|
'table' => 'viewtest'))
|
594
|
|
|
);
|
595
|
|
|
// Click the "Empty" button to clean the content of the table.
|
596
|
|
|
$this->assertTrue($this->clickSubmit($lang['strempty']));
|
597
|
|
|
|
598
|
|
|
// Verify whether the table is emptied successfully.
|
599
|
|
|
$this->assertTrue($this->assertWantedText($lang['strtableemptied']));
|
600
|
|
|
|
601
|
|
|
return TRUE;
|
602
|
|
|
}
|
603
|
|
|
|
604
|
|
|
|
605
|
|
|
/**
|
606
|
|
|
* TestCaseID: HAT01
|
607
|
|
|
* Alter the properties of an existing table.
|
608
|
|
|
*/
|
609
|
|
|
function testAlterTable()
|
610
|
|
|
{
|
611
|
|
|
global $webUrl;
|
612
|
|
|
global $lang, $SERVER, $DATABASE;
|
613
|
|
|
|
614
|
|
|
// Drop the table.
|
615
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
616
|
|
|
'server' => $SERVER,
|
617
|
|
|
'database' => $DATABASE,
|
618
|
|
|
'schema' => 'public',
|
619
|
|
|
'subject' => 'schema'))
|
620
|
|
|
);
|
621
|
|
|
// Select the table.
|
622
|
|
|
$this->assertTrue($this->get("$webUrl/tblproperties.php", array(
|
623
|
|
|
'server' => $SERVER,
|
624
|
|
|
'action' => 'confirm_alter',
|
625
|
|
|
'database' => $DATABASE,
|
626
|
|
|
'schema' => 'public',
|
627
|
|
|
'table' => 'viewtest'))
|
628
|
|
|
);
|
629
|
|
|
|
630
|
|
|
$this->assertTrue($this->setField('name', 'testview'));
|
631
|
|
|
$this->assertTrue($this->setField('owner', 'tester'));
|
632
|
|
|
$this->assertTrue($this->setField('tablespace', 'pg_default'));
|
633
|
|
|
|
634
|
|
|
$this->assertTrue($this->clickSubmit($lang['stralter']));
|
635
|
|
|
$this->assertTrue($this->assertWantedText($lang['strtablealtered']));
|
636
|
|
|
|
637
|
|
|
return TRUE;
|
638
|
|
|
}
|
639
|
|
|
|
640
|
|
|
|
641
|
|
|
/**
|
642
|
|
|
* TestCaseID: HDT01
|
643
|
|
|
* Drop an existing table.
|
644
|
|
|
*/
|
645
|
|
|
function testDropTable()
|
646
|
|
|
{
|
647
|
|
|
global $webUrl;
|
648
|
|
|
global $lang, $SERVER, $DATABASE;
|
649
|
|
|
|
650
|
|
|
// Drop the table.
|
651
|
|
|
$this->assertTrue($this->get("$webUrl/tables.php", array(
|
652
|
|
|
'server' => $SERVER,
|
653
|
|
|
'action' => 'confirm_drop',
|
654
|
|
|
'database' => $DATABASE,
|
655
|
|
|
'schema' => 'public',
|
656
|
|
|
'table' => 'testview'))
|
657
|
|
|
);
|
658
|
|
|
|
659
|
|
|
$this->assertTrue($this->setField('cascade', TRUE));
|
660
|
|
|
// Click the "Drop" button to drop the table.
|
661
|
|
|
$this->assertTrue($this->clickSubmit($lang['strdrop']));
|
662
|
|
|
|
663
|
|
|
// Verify whether the table is dropped successfully.
|
664
|
|
|
$this->assertTrue($this->assertWantedText($lang['strtabledropped']));
|
665
|
|
|
|
666
|
|
|
return TRUE;
|
667
|
|
|
}
|
668
|
|
|
}
|
669
|
|
|
?>
|
670
|
|
|
|