1
|
|
|
<?php
|
2
|
|
|
/**
|
3
|
|
|
* Function area: Schemas
|
4
|
|
|
* Subfunction area: Sequence
|
5
|
|
|
* @author Augmentum SpikeSource Team
|
6
|
|
|
* @copyright 2005 by Augmentum, Inc.
|
7
|
|
|
*/
|
8
|
|
|
|
9
|
|
|
|
10
|
|
|
// Import the precondition class.
|
11
|
|
|
if(is_dir('../Public')) {
|
12
|
|
|
require_once('../Public/SetPrecondition.php');
|
13
|
|
|
}
|
14
|
|
|
|
15
|
|
|
|
16
|
|
|
/**
|
17
|
|
|
* A test case suite for testing SEQUENCE feature in phpPgAdmin, including
|
18
|
|
|
* cases for creating, resetting and dropping sequences.
|
19
|
|
|
*/
|
20
|
|
|
class SequenceTest extends PreconditionSet
|
21
|
|
|
{
|
22
|
|
|
/**
|
23
|
|
|
* Set up the precondition.
|
24
|
|
|
*/
|
25
|
|
|
function setUp()
|
26
|
|
|
{
|
27
|
|
|
global $webUrl;
|
28
|
|
|
global $SUPER_USER_NAME;
|
29
|
|
|
global $SUPER_USER_PASSWORD;
|
30
|
|
|
|
31
|
|
|
// Login the system.
|
32
|
|
|
$this->login($SUPER_USER_NAME, $SUPER_USER_PASSWORD,
|
33
|
|
|
"$webUrl/login.php");
|
34
|
|
|
|
35
|
|
|
return TRUE;
|
36
|
|
|
}
|
37
|
|
|
|
38
|
|
|
|
39
|
|
|
/**
|
40
|
|
|
* Clean up all the result.
|
41
|
|
|
*/
|
42
|
|
|
function tearDown()
|
43
|
|
|
{
|
44
|
|
|
// Logout from the system.
|
45
|
|
|
$this->logout();
|
46
|
|
|
|
47
|
|
|
return TRUE;
|
48
|
|
|
}
|
49
|
|
|
|
50
|
|
|
|
51
|
|
|
/**
|
52
|
|
|
* TestCaseID: HCS01
|
53
|
|
|
* Create a sequence.
|
54
|
|
|
*/
|
55
|
|
|
function testCreateSequence()
|
56
|
|
|
{
|
57
|
|
|
global $webUrl;
|
58
|
|
|
global $lang, $SERVER, $DATABASE;
|
59
|
|
|
|
60
|
|
|
// Turn to the "Create sequence" page.
|
61
|
|
|
$this->assertTrue($this->get("$webUrl/sequences.php", array(
|
62
|
|
|
'server' => $SERVER,
|
63
|
|
|
'action' => 'create',
|
64
|
|
|
'database' => $DATABASE,
|
65
|
|
|
'schema' => 'public'))
|
66
|
|
|
);
|
67
|
|
|
|
68
|
|
|
// Enter the detail information of a sequence.
|
69
|
|
|
$this->assertTrue($this->setField('formSequenceName', 'createsequence'));
|
70
|
|
|
$this->assertTrue($this->setField('formIncrement', '1'));
|
71
|
|
|
$this->assertTrue($this->setField('formMinValue', '1000'));
|
72
|
|
|
$this->assertTrue($this->setField('formMaxValue', '10000'));
|
73
|
|
|
$this->assertTrue($this->setField('formStartValue', '1000'));
|
74
|
|
|
$this->assertTrue($this->setField('formCacheValue', '5'));
|
75
|
|
|
$this->assertTrue($this->setField('formCycledValue', TRUE));
|
76
|
|
|
|
77
|
|
|
// Click the "Create" button to create a sequence.
|
78
|
|
|
$this->assertTrue($this->clickSubmit($lang['strcreate']));
|
79
|
|
|
|
80
|
|
|
// Verify whether the sequence is created successfully.
|
81
|
|
|
$this->assertTrue($this->assertWantedText($lang['strsequencecreated']));
|
82
|
|
|
|
83
|
|
|
return TRUE;
|
84
|
|
|
}
|
85
|
|
|
|
86
|
|
|
|
87
|
|
|
/**
|
88
|
|
|
* TestCaseID: HRS01
|
89
|
|
|
* Reset an existing sequence.
|
90
|
|
|
*/
|
91
|
|
|
function testResetSequence()
|
92
|
|
|
{
|
93
|
|
|
global $webUrl;
|
94
|
|
|
global $lang, $SERVER, $DATABASE;
|
95
|
|
|
|
96
|
|
|
// Turn to the sequence-display page.
|
97
|
|
|
$this->assertTrue($this->get("$webUrl/sequences.php", array(
|
98
|
|
|
'server' => $SERVER,
|
99
|
|
|
'database' => $DATABASE,
|
100
|
|
|
'schema' => 'public',
|
101
|
|
|
'subject' => 'schema'))
|
102
|
|
|
);
|
103
|
|
|
// Browse the specified sequence.
|
104
|
|
|
$this->assertTrue($this->clickLink('createsequence'));
|
105
|
|
|
// Reset the sequence.
|
106
|
|
|
$this->assertTrue($this->clickLink($lang['strreset']));
|
107
|
|
|
|
108
|
|
|
// Verify whether the sequence is reset successfully.
|
109
|
|
|
$this->assertTrue($this->assertWantedText($lang['strsequencereset']));
|
110
|
|
|
// Display all the sequence.
|
111
|
|
|
$this->assertTrue($this->clickLink($lang['strshowallsequences']));
|
112
|
|
|
|
113
|
|
|
return TRUE;
|
114
|
|
|
}
|
115
|
|
|
|
116
|
|
|
|
117
|
|
|
/**
|
118
|
|
|
* TestCaseID: HDS01
|
119
|
|
|
* Drop a sequence.
|
120
|
|
|
*/
|
121
|
|
|
function testDropSequence()
|
122
|
|
|
{
|
123
|
|
|
global $webUrl;
|
124
|
|
|
global $lang, $SERVER, $DATABASE;
|
125
|
|
|
|
126
|
|
|
$this->assertTrue($this->get("$webUrl/sequences.php", array(
|
127
|
|
|
'server' => $SERVER,
|
128
|
|
|
'action' => 'confirm_drop',
|
129
|
|
|
'database' => $DATABASE,
|
130
|
|
|
'schema' => 'public',
|
131
|
|
|
'sequence' => 'createsequence'))
|
132
|
|
|
);
|
133
|
|
|
|
134
|
|
|
$this->assertTrue($this->setField('cascade', TRUE));
|
135
|
|
|
$this->assertTrue($this->clickSubmit($lang['strdrop']));
|
136
|
|
|
|
137
|
|
|
// Verify if the sequence dropped successful.
|
138
|
|
|
$this->assertTrue($this->assertWantedText($lang['strsequencedropped']));
|
139
|
|
|
|
140
|
|
|
return TRUE;
|
141
|
|
|
}
|
142
|
|
|
}
|
143
|
|
|
?>
|
144
|
|
|
|