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

InfoTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 115
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 115
rs 10
c 0
b 0
f 0
wmc 6
1
<?php
2
 /**
3
  * Function area:       Table
4
  * Subfunction area:    Info
5
  * @author     Augmentum SpikeSource Team 
6
  * @copyright  2005 by Augmentum, Inc.
7
  */
8
9
// Import the precondition class.
10
if(is_dir('../Public')) 
11
{
12
    require_once('../Public/SetPrecondition.php');
13
}
14
15
16
/**
17
 * A test case suite for testing INFO feature in phpPgAdmin
18
 */
19
class InfoTest extends PreconditionSet{
20
    
21
    /**
22
     * Set up the preconditon. 
23
     */
24
    function setUp()
25
    {
26
        global $webUrl;
27
        global $lang;
28
        global $POWER_USER_NAME;
29
        global $POWER_USER_PASSWORD;
30
        
31
        $this->login($POWER_USER_NAME, $POWER_USER_PASSWORD, 
32
                     "$webUrl/login.php");
33
        
34
        return TRUE;
35
    }
36
    
37
    /**
38
     * Clean up all the result. 
39
     */ 
40
    function tearDown(){
41
        $this->logout(); 
42
        
43
        return TRUE;
44
    }    
45
    
46
    /**
47
     * TestCaseID: TSI01
48
     * List the performance info of the parent table -- student
49
     */ 
50
    function testListParentTableInfo()
51
    {
52
        global $webUrl;
53
        global $lang, $SERVER, $DATABASE;
54
        
55
        // Go to the Rules page
56
		$this->assertTrue($this->get("$webUrl/info.php", array(
57
			            'server' => $SERVER,
58
						'database' => $DATABASE,
59
						'schema' => 'public',
60
						'table' => 'student',
61
						'subject' => 'table'))
62
					);
63
        
64
        return TRUE;            
65
    }
66
    
67
    
68
    /**
69
     * TestCaseID: TSI02
70
     * List the performance info of the children table -- college_student
71
     */ 
72
    function testListChildrenTableInfo()
73
    {
74
        global $webUrl;
75
        global $lang, $SERVER, $DATABASE;
76
        
77
        // Go to the Rules page
78
		$this->assertTrue($this->get("$webUrl/info.php", array(
79
			            'server' => $SERVER,
80
						'database' => $DATABASE,
81
						'schema' => 'public',
82
						'table' => 'college_student',
83
						'subject' => 'table'))
84
					); 
85
        
86
        return TRUE;          
87
    }
88
    
89
    
90
    /**
91
     * TestCaseID: TSI03
92
     * List the performance info of the foreign table -- department
93
     */ 
94
    function testListForeignTableInfo()
95
    {
96
        global $webUrl;
97
        global $lang, $SERVER, $DATABASE;
98
        
99
        // Go to the Rules page
100
		$this->assertTrue($this->get("$webUrl/info.php", array(
101
			            'server' => $SERVER,
102
						'database' => $DATABASE,
103
						'schema' => 'public',
104
						'table' => 'department',
105
						'subject' => 'table'))
106
					);
107
        
108
        return TRUE;
109
    }
110
111
    /**
112
     * TestCaseID: TSP01
113
     * Show the properties of the foreign key constraint
114
     */ 
115
    function testShowForeignKeyProperties()
116
    {
117
        global $webUrl;
118
        global $lang, $SERVER, $DATABASE;
119
        
120
        // Go to the Rules page
121
		$this->assertTrue($this->get("$webUrl/info.php?", array(
122
            'server' => $SERVER,
123
			'database' => $DATABASE,
124
			'schema' => 'public',
125
			'table' => 'department',
126
			'subject' => 'table'))
127
		);
128
             
129
        $this->assertTrue($this->clickLink($lang['strproperties']));
130
        $this->assertWantedText('FOREIGN KEY (dep_id) REFERENCES department(id) ' . 
131
                                'ON UPDATE RESTRICT ON DELETE RESTRICT'); 
132
        
133
        return TRUE;         
134
    }    
135
}
136
?>
137