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

FindObjectsTest::testFindObjsInSchemas()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 138
Code Lines 91

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 91
nc 1
nop 0
dl 0
loc 138
rs 8.2857
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * Function area     : Database.
4
 * Sub Function area : FindObjects.
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 FindObjects implementation.
18
 */
19
class FindObjectsTest extends PreconditionSet
20
{
21
    /**
22
     * Set up the preconditon.
23
     */
24
    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...
25
    {
26
        global $webUrl;
27
        global $SUPER_USER_NAME;
28
        global $SUPER_USER_PASSWORD;
29
        $this->login($SUPER_USER_NAME, $SUPER_USER_PASSWORD,
30
                     "$webUrl/login.php");
31
32
        return TRUE;
33
    }
34
35
36
    /**
37
     * Release the relational resource.
38
     */
39
    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...
40
    {
41
        // Logout this system.
42
        $this->logout();
43
        return TRUE;
44
    }
45
46
47
    /**
48
     * TestCaseId: DFO001
49
     * This test is used to find objects in the search component.
50
     */
51
    function testSimpleFindObject()
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...
52
    {
53
        global $webUrl;
54
        global $lang, $SERVER, $DATABASE;
55
56
        // Locate the list page of databases.
57
		$this->assertTrue($this->get("$webUrl/database.php", array(
58
			'server' => $SERVER,
59
			'database' => $DATABASE,
60
			'subject' => 'database',
61
			'action' => 'find'))
62
		);
63
64
        $this->assertTrue($this->setField('term', 'student'));
65
        $this->assertTrue($this->setField('filter', 'All objects'));
66
        $this->assertTrue($this->clickSubmit ($lang['strfind']));
67
        return true;
68
    }
69
70
71
    /**
72
     * TestCaseId: DFO002
73
     * This test is used to find objects in the search component.
74
     */
75
    function testFindObjsInSchemas()
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...
76
    {
77
        global $webUrl;
78
        global $lang, $SERVER, $DATABASE;
79
80
        // Locate the list page of databases.
81
		$this->assertTrue($this->get("$webUrl/database.php", array(
82
            'server' => $SERVER,
83
			'database' => $DATABASE,
84
			'subject' => 'database',
85
			'action' => 'find'))
86
		);
87
88
        $this->assertTrue($this->setField('term', 'student'));
89
        $this->assertTrue($this->setField('filter', 'Schemas'));
90
        $this->assertTrue($this->clickSubmit ($lang['strfind']));
91
92
        // Locate the list page of databases.
93
		$this->assertTrue($this->get("$webUrl/database.php", array(
94
			            'server' => $SERVER,
95
						'database' => $DATABASE,
96
						'subject' => 'database',
97
						'action' => 'find'))
98
					);
99
100
        $this->assertTrue($this->setField('term', 'student'));
101
        $this->assertTrue($this->setField('filter', 'Tables'));
102
        $this->assertTrue($this->clickSubmit ($lang['strfind']));
103
104
        // Locate the list page of databases.
105
		$this->assertTrue($this->get("$webUrl/database.php", array(
106
			            'server' => $SERVER,
107
						'database' => $DATABASE,
108
						'subject' => 'database',
109
						'action' => 'find'))
110
					);
111
112
        $this->assertTrue($this->setField('term', 'student'));
113
        $this->assertTrue($this->setField('filter', 'Views'));
114
        $this->assertTrue($this->clickSubmit ($lang['strfind']));
115
116
        // Locate the list page of databases.
117
		$this->assertTrue($this->get("$webUrl/database.php", array(
118
		               'server' => $SERVER,
119
					   'database' => $DATABASE,
120
					   'subject' => 'database',
121
					   'action' => 'find'))
122
				   );
123
124
        $this->assertTrue($this->setField('term', 'student'));
125
        $this->assertTrue($this->setField('filter', 'Sequences'));
126
        $this->assertTrue($this->clickSubmit ($lang['strfind']));
127
128
        // Locate the list page of databases.
129
		$this->assertTrue($this->get("$webUrl/database.php", array(
130
			            'server' => $SERVER,
131
						'database' => $DATABASE,
132
						'subject' => 'database',
133
						'action' => 'find'))
134
					);
135
136
        $this->assertTrue($this->setField('term', 'student'));
137
        $this->assertTrue($this->setField('filter', 'Columns'));
138
        $this->assertTrue($this->clickSubmit ($lang['strfind']));
139
140
        // Locate the list page of databases.
141
		$this->assertTrue($this->get("$webUrl/database.php", array(
142
			            'server' => $SERVER,
143
						'database' => $DATABASE,
144
						'subject' => 'database',
145
						'action' => 'find'))
146
					);
147
148
        $this->assertTrue($this->setField('term', 'student'));
149
        $this->assertTrue($this->setField('filter', 'Rules'));
150
        $this->assertTrue($this->clickSubmit ($lang['strfind']));
151
152
        // Locate the list page of databases.
153
		$this->assertTrue($this->get("$webUrl/database.php", array(
154
		               'server' => $SERVER,
155
					   'database' => $DATABASE,
156
					   'subject' => 'database',
157
					   'action' => 'find'))
158
				   );
159
160
        $this->assertTrue($this->setField('term', 'student'));
161
        $this->assertTrue($this->setField('filter', 'Indexes'));
162
        $this->assertTrue($this->clickSubmit ($lang['strfind']));
163
164
        // Locate the list page of databases.
165
		$this->assertTrue($this->get("$webUrl/database.php", array(
166
		               'server' => $SERVER,
167
					   'database' => $DATABASE,
168
					   'subject' => 'database',
169
					   'action' => 'find'))
170
				   );
171
172
        $this->assertTrue($this->setField('term', 'student'));
173
        $this->assertTrue($this->setField('filter', 'Triggers'));
174
        $this->assertTrue($this->clickSubmit ($lang['strfind']));
175
176
        // Locate the list page of databases.
177
		$this->assertTrue($this->get("$webUrl/database.php", array(
178
			            'server' => $SERVER,
179
						'database' => $DATABASE,
180
						'subject' => 'database',
181
						'action' => 'find'))
182
					);
183
184
        $this->assertTrue($this->setField('term', 'student'));
185
        $this->assertTrue($this->setField('filter', 'Constraints'));
186
        $this->assertTrue($this->clickSubmit ($lang['strfind']));
187
188
        // Locate the list page of databases.
189
		$this->assertTrue($this->get("$webUrl/database.php", array(
190
			            'server' => $SERVER,
191
						'database' => $DATABASE,
192
						'subject' => 'database',
193
						'action' => 'find'))
194
					);
195
196
        $this->assertTrue($this->setField('term', 'student'));
197
        $this->assertTrue($this->setField('filter', 'Functions'));
198
        $this->assertTrue($this->clickSubmit ($lang['strfind']));
199
200
        // Locate the list page of databases.
201
		$this->assertTrue($this->get("$webUrl/database.php", array(
202
			            'server' => $SERVER,
203
						'database' => $DATABASE,
204
						'subject' => 'database',
205
						'action' => 'find'))
206
					);
207
208
        $this->assertTrue($this->setField('term', 'student'));
209
        $this->assertTrue($this->setField('filter', 'Domains'));
210
        $this->assertTrue($this->clickSubmit ($lang['strfind']));
211
212
        return true;
213
    }
214
215
216
    /**
217
     * TestCaseId: DFO003
218
     * This test is used to find objects in the search component in top bar.
219
     */
220
    function testFindTopObjects()
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...
221
    {
222
        global $webUrl;
223
        global $lang, $SERVER, $DATABASE;
224
225
        // Locate the list page of databases.
226
		$this->assertTrue($this->get("$webUrl/sqledit.php", array(
227
			'server' => $SERVER,
228
			'action' => 'find'))
229
		);
230
231
        $this->assertTrue($this->setField('database', $DATABASE));
232
        $this->assertTrue($this->setField('term', 'All objects'));
233
        $this->assertTrue($this->clickSubmit ($lang['strfind']));
234
        return true;
235
    }
236
}
237
238
?>
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...
239