Passed
Branch develop (7ff7f1)
by Felipe
10:16 queued 06:26
created

HelpTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 86
rs 10
c 0
b 0
f 0
wmc 4
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()
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()
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()
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()
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
?>
110