Test Failed
Branch develop (db5506)
by Felipe
03:46
created

SchemaBasicTest::testDropBasSchema()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 19
nc 1
nop 0
dl 0
loc 28
rs 8.8571
c 0
b 0
f 0
1
<?php
2
/**
3
 * Function area     : Database.
4
 * Sub Function area : SchemaBasic.
5
 * 
6
 * @author     Augmentum SpikeSource Team
7
 * @copyright  Copyright (c) 2005 by Augmentum, Inc.
8
 */
9
10
11
// Import the precondition class.
12
if (is_dir('../Public'))
13
{
14
    require_once('../Public/SetPrecondition.php');
15
}
16
17
/**
18
 * This class is to test the Schema Basic Management of
19
 * PostgreSql implementation.
20
 */
21
class SchemaBasicTest extends PreconditionSet
22
{
23
    /**
24
     * Set up the preconditon.
25
     */
26
    function setUp()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
27
    {
28
        global $webUrl;
29
        global $SUPER_USER_NAME;
30
        global $SUPER_USER_PASSWORD;
31
32
        $this->login($SUPER_USER_NAME, $SUPER_USER_PASSWORD,
33
            "$webUrl/login.php");
34
35
        return TRUE;
36
    }
37
38
39
    /**
40
     * Release the relational resource.
41
     */
42
    function tearDown()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
43
    {
44
        // Logout this system.
45
        $this->logout();
46
47
        return TRUE;
48
    }
49
50
51
    /**
52
     * TestCaseId: DCS001
53
     * This test is used to create one new schema for super user.
54
     */
55
    function testCreateBasSchema()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
56
    {
57
        global $webUrl, $SUPER_USER_NAME;
58
        global $lang, $SERVER, $DATABASE;
59
60
		$this->assertTrue($this->get("$webUrl/database.php", array(
61
			            'server' => $SERVER,
62
						'database' => $DATABASE,
63
						'subject' => 'database'))
64
					);
65
		$this->assertTrue($this->get("$webUrl/schemas.php", array(
66
			            'server' => $SERVER,
67
						'database' => $DATABASE,
68
						'action' => 'create'))
69
					);
70
71
        $this->assertTrue($this->setField('formName', 'testSchemaName'));
72
        $this->assertTrue($this->setField('formAuth', $SUPER_USER_NAME));
73
        $this->assertTrue($this->setField('formComment',
74
                                          'Comment of test schema.'));
75
76
        $this->assertTrue($this->clickSubmit($lang['strcreate']));
77
78
        $this->assertWantedText($lang['strschemacreated']);
79
80
        return TRUE;
81
    }
82
83
    
84
    /**
85
     * TestCaseId: DAS001
86
     * This test is used to modify one existent schema for super user.
87
     */
88
    function testAlterBasSchema()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
89
    {
90
        global $webUrl;
91
        global $lang, $SERVER, $DATABASE;
92
93
		$this->assertTrue($this->get("$webUrl/database.php", array(
94
			            'server' => $SERVER,
95
						'database' => $DATABASE,
96
						'subject' => 'database'))
97
		);
98
		$this->assertTrue($this->get("$webUrl/redirect.php", array(
99
			            'server' => $SERVER,
100
						'section' => 'database',
101
						'database' => $DATABASE))
102
		);
103
		$this->assertTrue($this->get("$webUrl/database.php", array(
104
			            'server' => $SERVER,
105
						'database' => $DATABASE,
106
						'subject' => 'database'))
107
		);
108
		$this->assertTrue($this->get("$webUrl/schemas.php", array(
109
			            'server' => $SERVER,
110
						'action' => 'alter',
111
						'database' => $DATABASE,
112
						'schema' => 'testSchemaName'))
113
		);
114
115
        $this->assertTrue($this->setField('comment',
116
                                          'The comment has been changed.'));
117
        $this->assertTrue($this->clickSubmit('Alter'));
118
119
        $this->assertWantedText($lang['strschemaaltered']);
120
121
        return TRUE;
122
    }
123
124
    
125
    /**
126
     * TestCaseId: DDS001
127
     * This test is used to drop one existent schema for super user.
128
     */
129
    function testDropBasSchema()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
130
    {
131
        global $webUrl;
132
        global $lang, $SERVER, $DATABASE;
133
134
		$this->assertTrue($this->get("$webUrl/database.php", array(
135
			            'server' => $SERVER,
136
						'database' => $DATABASE,
137
						'subject' => 'database'))
138
		);
139
		$this->assertTrue($this->get("$webUrl/redirect.php", array(
140
			            'server' => $SERVER,
141
						'section' => 'database',
142
						'database' => $DATABASE))
143
		);
144
		$this->assertTrue($this->get("$webUrl/schemas.php", array(
145
			            'server' => $SERVER,
146
						'action' => 'drop',
147
						'database' => $DATABASE,
148
						'schema' => 'testSchemaName'))
149
		);
150
151
        $this->assertTrue($this->setField('cascade', TRUE));
152
        $this->assertTrue($this->clickSubmit($lang['strdrop']));
153
154
        $this->assertWantedText($lang['strschemadropped']);
155
        
156
        return TRUE;
157
    }
158
}
159
160
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
161