24 require_once(dirname(__FILE__) .
'/../common-parm.php');
32 protected function setUp()
42 print
"Starting unit test for common-parm.php\n";
43 print
"test function GetParm()\n";
48 $result =
GetParm($Name, $Type);
49 $this->assertEquals(
"20", $result);
53 $result =
GetParm($Name, $Type);
54 $this->assertEquals(
"20.2", $result);
56 $_GET[$Name] =
"/test/";
58 $result =
GetParm($Name, $Type);
59 $this->assertEquals(
"/test/", $result);
61 $_GET[$Name] =
"\\test\\";
63 $result =
GetParm($Name, $Type);
64 $this->assertEquals(
"test", $result);
66 $_GET[$Name] =
"\\test\\";
68 $result =
GetParm($Name, $Type);
69 $this->assertEquals(
"\\test\\", $result);
71 $_POST[$Name] = $_GET[$Name];
74 $result =
GetParm($Name, $Type);
75 $this->assertEquals(
"test", $result);
78 $result =
GetParm($Name, $Type);
79 $this->assertEquals(
"", $result);
87 print
"test function Traceback()\n";
88 $expected =
"http://fossology.org/";
89 $_SERVER[
'REQUEST_URI'] = $expected;
91 $this->assertEquals($expected, $result);
99 print
"test function Traceback_uri()\n";
100 $source =
"http://fossology.org/?mod=test&parm=abc";
101 $expected =
"http://fossology.org/";
102 $_SERVER[
'REQUEST_URI'] = $source;
104 $this->assertEquals($expected, $result);
112 print
"test function Traceback_parm()\n";
113 $source1 =
"http://fossology.org/?mod=test";
114 $source2 =
"http://fossology.org/?mod=test&parm=abc";
115 $expected1 =
"test&parm=abc";
116 $expected2 =
"&parm=abc";
117 $_SERVER[
'REQUEST_URI'] = $source1;
119 $this->assertEquals(
"test", $result);
120 $_SERVER[
'REQUEST_URI'] = $source2;
122 $this->assertEquals($expected1, $result);
124 $this->assertEquals($expected2, $result);
132 print
"test function Traceback_parm_keep()\n";
133 $List = array(
'parm1',
'parm2');
134 $_GET[
'parm1'] =
"parm1";
135 $expected =
"&parm1=parm1";
137 $this->assertEquals($expected, $result);
145 print
"test function Traceback_dir()\n";
146 $source =
"http://fossology.org/repo/testdir?mod=test&parm=abc";
147 $_SERVER[
'REQUEST_URI'] = $source;
148 $expected =
"http://fossology.org/repo/";
150 $this->assertEquals($expected, $result);
151 print
"Ending unit test for common-parm.php\n";
Traceback_uri()
Get the URI without query to this location.
test_Traceback_parm()
test for Traceback_parm()
Traceback_parm($ShowMod=1)
Get the URI query to this location.
test_Traceback_dir()
test for Traceback_dir()
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
test_Traceback_uri()
test for Traceback_uri()
test_Traceback()
test for Traceback()
Traceback_dir()
Get the directory of the URI without query.
Traceback_parm_keep($List)
Create a new URI, keeping only these items.
Traceback()
Get the URI + query to this location.
test_GetParm()
test for GetParm($Name, $Type)
test_Traceback_parm_keep()
test for Traceback_parm_keep()