Passed
Push — master ( edcd19...7b8e38 )
by Felipe
05:02
created

AdminTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 140
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 140
rs 10
c 0
b 0
f 0
wmc 7
1
<?php
2
/**
3
 * Function area     : Database.
4
 * Sub Function area : Admin.
5
 * 
6
 * @author     Augmentum SpikeSource Team
7
 * @copyright  Copyright (c) 2005 by Augmentum, Inc.
8
 */
9
10
// Import the precondition class.
11
if (is_dir('../Public'))
12
{
13
    require_once('../Public/SetPrecondition.php');
14
} 
15
16
/**
17
 * This class is to test the Admin about PostgreSql implementation.
18
 */
19
20
class AdminTest extends PreconditionSet
21
{
22
    /**
23
     * Set up the preconditon.
24
     */
25
    function setUp()
26
    {
27
        global $webUrl;
28
        global $SUPER_USER_NAME;
29
        global $SUPER_USER_PASSWORD;
30
        $this->login($SUPER_USER_NAME, $SUPER_USER_PASSWORD,
31
                     "$webUrl/login.php");
32
33
        return TRUE;
34
    }
35
36
37
    /**
38
     * Release the relational resource.
39
     */
40
    function tearDown()
41
    {
42
        // Logout this system.
43
        $this->logout();
44
45
        return TRUE;
46
    }
47
48
49
    /**
50
     * TestCaseId: DAV001
51
     * This test is used to test the admin about Vacuum and full.
52
     */
53
    function testAdminVacuumAna()
54
    {
55
        global $webUrl, $lang, $SERVER, $DATABASE;
56
        
57
        // Locate the list page of admin.
58
		$this->assertTrue($this->get("$webUrl/database.php",
59
			array('database' => $DATABASE,
60
				'subject' => 'database',
61
				'action' => 'admin',
62
				'server' => $SERVER))
63
		);
64
        $this->assertTrue($this->setField('vacuum_analyze', TRUE));
65
        $this->assertTrue($this->setField('vacuum_full', TRUE));
66
        $this->assertTrue($this->clickSubmit($lang['strvacuum']));
67
        $this->assertWantedText($lang['strvacuumgood']);
68
69
        return TRUE;
70
    }
71
72
73
    /**
74
     * TestCaseId: DCS002
75
     * This test is used to test the admin about freeze.
76
     */
77
    function testAdminFreeze()
78
    {
79
        global $webUrl, $lang, $SERVER, $DATABASE;
80
        
81
        // Locate the list page of admin.
82
		$this->assertTrue($this->get("$webUrl/database.php",
83
			array('database' => $DATABASE,
84
				'subject' => 'database',
85
				'action' => 'admin',
86
				'server' => $SERVER))
87
		);
88
        $this->assertTrue($this->setField('vacuum_freeze', TRUE));
89
        $this->assertTrue($this->clickSubmit($lang['strvacuum']));
90
        $this->assertWantedText($lang['strvacuumgood']);
91
92
        return TRUE;
93
    }
94
95
96
    /**
97
     * TestCaseId: DCS003
98
     * This test is used to test the admin about Analyze.
99
     */
100
    function testAdminAnalyze()
101
    {
102
        global $webUrl, $lang, $SERVER, $DATABASE;
103
        
104
        // Locate the list page of admin.
105
		$this->assertTrue($this->get("$webUrl/database.php",
106
			array('database' => $DATABASE,
107
				'subject' => 'database',
108
				'action' => 'admin',
109
				'server' => $SERVER))
110
		);
111
        $this->assertTrue($this->clickSubmit($lang['stranalyze']));
112
        $this->assertWantedText($lang['stranalyzegood']);
113
114
        return TRUE;
115
    }
116
117
118
    /**
119
     * TestCaseId: DCS004
120
     * This test is used to test the admin about Cluster.
121
     */
122
    function testAdminCluster()
123
    {
124
        global $webUrl, $lang, $SERVER, $DATABASE;
125
        
126
        // Locate the list page of admin.
127
		$this->assertTrue($this->get("$webUrl/database.php", array(
128
				'server' => $SERVER,
129
				'database' => $DATABASE,
130
				'subject' => 'database',
131
				'action' => 'admin'))
132
		);
133
        $this->assertTrue($this->clickSubmit($lang['strcluster']));
134
        $this->assertWantedText($lang['strclusteredgood']);
135
136
        return TRUE;
137
    }
138
139
140
    /**
141
     * TestCaseId: DCS005
142
     * This test is used to test the admin about Reindex.
143
     */
144
    function testAdminReindex()
145
    {
146
        global $webUrl, $lang, $SERVER, $DATABASE;
147
148
        // Locate the list page of admin.
149
		$this->assertTrue($this->get("$webUrl/database.php", array(
150
				'database' => $DATABASE,
151
				'subject' => 'database',
152
				'action' => 'admin',
153
				'server' => $SERVER))
154
		);
155
        $this->assertTrue($this->setField('reindex_force', TRUE));
156
        $this->assertTrue($this->clickSubmit($lang['strreindex']));
157
        $this->assertWantedText($lang['strreindexgood']);
158
159
        return TRUE;
160
    }
161
}
162
163
?>
164