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

HelpTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Function area     : Database.
4
 * Sub Function area : Help.
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
/**
18
 * This class is to test the help sub function.
19
 */
20
class HelpTest extends PreconditionSet
21
{
22
    /**
23
     * Set up the preconditon.
24
     */
25
    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...
26
    {
27
        global $webUrl;
28
        global $SUPER_USER_NAME;
29
        global $SUPER_USER_PASSWORD;
30
31
        $this->login($SUPER_USER_NAME, $SUPER_USER_PASSWORD,
32
            "$webUrl/login.php");
33
34
        return TRUE;
35
    }
36
37
38
    /**
39
     * Release the relational resource.
40
     */
41
    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...
42
    {
43
        // Logout this system.
44
        $this->logout();
45
46
        return TRUE;
47
    }
48
49
50
    /**
51
     * TestCaseId:DCD001;
52
     * This test is used to test help links.
53
     *
54
     * Note: It's strange here, because all the links are outside.
55
     *       So the Pattern cannot be invoked directly.
56
     */
57
    function testHelpWithInnerSchema()
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...
58
    {
59
        global $webUrl;
60
        global $lang, $SERVER, $DATABASE;
61
62
        // Locate the list page of database.
63
		$this->assertTrue($this->get("$webUrl/database.php", array(
64
		               'server' => $SERVER,
65
					   'database' => $DATABASE,
66
					   'subject' => 'database'))
67
				   );
68
69
        // Click the link about help.
70
        $this->assertTrue($this->get("$webUrl/help.php"));
71
        $this->assertTrue($this->get("$webUrl/help.php?help=pg.schema"));
72
        $this->assertTrue($this->get("$webUrl/help.php?help=pg.column.add"));
73
74
        // Comment this for avoiding error by Xdebug.
75
        // Becase we cannot assert something about the content of the page via
76
        // hyperlink outside
77
        // $this->assertWantedPattern('/"Schemas"/');
78
79
        return TRUE;
80
    }
81
82
83
    /**
84
     * TestCaseId:DCD002;
85
     * This test is used to test help links from the index links.
86
     */
87
    function testHelpWithInrClk()
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...
88
    {
89
        global $webUrl, $SERVER, $DATABASE;
90
91
        // Locate the list page of language.
92
		$this->assertTrue($this->get("$webUrl/database.php", array(
93
			'server' => $SERVER,
94
			'database' => $DATABASE,
95
			'subject' => 'database'))
96
		);
97
98
        $this->assertTrue($this->get("$webUrl/help.php", array('server' => $SERVER)));        
99
100
		// XXX fail because of the version number in the URL
101
		$this->assertTrue($this->clickLink(/*'http://www.postgresql.org/docs/8.0/' .*/
102
                                           'interactive/sql-expressions.html' .
103
                                           '#SQL-SYNTAX-TYPE-CASTS'));
104
105
        return TRUE;
106
    }
107
}
108
109
?>
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...
110