16 require_once(
'../../../tests/fossologyTestCase.php');
17 require_once(
'../../../tests/commonTestFuncs.php');
18 require_once(
'../../../tests/TestEnvironment.php');
19 require_once(
'../../../tests/testClasses/parseMiniMenu.php');
20 require_once(
'../../../tests/testClasses/parseFolderPath.php');
22 require_once(
'../../../tests/testClasses/dom-parseLicenseTable.php');
41 $name =
'fossI16L335U29.tar.bz2';
42 $safeName = escapeDots($name);
43 $this->host = getHost($URL);
48 $page = $this->mybrowser->get($URL);
49 $page = $this->mybrowser->clickLink(
'Browse');
50 $this->assertTrue($this->myassertText($page,
'/Browse/'),
51 "verifyFossl16L335 FAILED! Could not find Browse menu\n");
52 $page = $this->mybrowser->clickLink(
'Testing');
53 $this->assertTrue($this->myassertText($page,
'/Testing/'),
54 "verifyFossl16L335 FAILED! Could not find Testing folder\n");
55 $result = $this->myassertText($page,
"/$safeName/");
56 if(!($result)) { exit(FALSE); }
59 function testVerifyFossl16L335()
66 $licenseCounts = array(
68 'No_license_found' => 72,
78 'FSF-possibility' => 1,
79 'GPL_v2-possibility' => 1,
84 'PHP-possibility' => 1,
86 'See-doc(OTHER)' => 1,
87 'X11-possibility' => 1,
91 $licenseSummary = array(
92 'Unique licenses'=> 22,
93 'Licenses found'=> 291,
94 'Files with no licenses'=> 72,
98 print
"starting VerifyFossl16L335 test\n";
99 $page = $this->mybrowser->clickLink(
'Browse');
100 $this->assertTrue($this->myassertText($page,
'/Browse/'),
101 "verifyFossl16L335 FAILED! Could not find Browse menu\n");
103 $page = $this->mybrowser->clickLink(
'Testing');
105 $this->assertTrue($this->myassertText($page,
"/Browse/"),
106 "verifyFossl16L335 FAILED! Browse Title not found\n");
107 $this->assertTrue($this->myassertText($page,
"/$safeName/"),
108 "verifyFossl16L335 FAILED! did not find $name\n");
109 $this->assertTrue($this->myassertText($page,
"/>View</"),
110 "verifyFossl16L335 FAILED! >View< not found\n");
111 $this->assertTrue($this->myassertText($page,
"/>Info</"),
112 "verifyFossl16L335 FAILED! >Info< not found\n");
113 $this->assertTrue($this->myassertText($page,
"/>Download</"),
114 "verifyFossl16L335 FAILED! >Download< not found\n");
117 $page = $this->mybrowser->clickLink($name);
119 $this->assertTrue($this->myassertText($page,
"/fossI16L335U29\.tar/"),
120 "FAILURE! Could not find fossI16L335U29.tar link\n");
123 $page = $this->mybrowser->clickLink(
'fossI16L335U29.tar');
124 $page = $this->mybrowser->clickLink(
'fossology/');
129 $this->assertTrue($this->myassertText($page,
"/Makefile/"));
130 $this->assertTrue($this->myassertText($page,
"/mkcheck\.sh/"),
131 "FAIL! did not find mkcheck.sh\n");
132 $this->assertTrue($this->myassertText($page,
"/>View</"),
133 "FAIL! >View< not found\n");
134 $this->assertTrue($this->myassertText($page,
"/>Info</"),
135 "FAIL! >Info< not found\n");
136 $this->assertTrue($this->myassertText($page,
"/>Download</"),
137 "FAIL! >Download< not found\n");
141 $miniMenu = $mini->parseMiniMenu();
142 $url = makeUrl($this->host, $miniMenu[
'License Browser']);
143 if($url === NULL) { $this->fail(
"verifyFossl16L335 Failed, host/url is not set"); }
145 $page = $this->mybrowser->get($url);
147 $this->assertTrue($this->myassertText($page,
'/License Browser/'),
148 "verifyFossl16L335 FAILED! Nomos License Browser Title not found\n");
152 $licSummary->parseLicenseTbl();
154 foreach ($licSummary->hList as $summary) {
155 $key = $summary[
'textOrLink'];
156 $this->assertEqual($licenseSummary[$key], $summary[
'count'],
157 "verifyFossl16L335 FAILED! $key does not equal $licenseSummary[$key],
158 got $summary[count]\n");
164 $licHistogram->parseLicenseTbl();
166 if($licHistogram->noRows === TRUE)
168 $this->fail(
"FATAL! no table rows to process, there should be many for"
169 .
" this test, Stopping the test");
180 foreach($licHistogram->hList as $licFound)
182 $key = $licFound[
'textOrLink'];
185 if(array_key_exists($key,$licenseCounts))
187 $this->assertEqual($licenseCounts[$key], $licFound[
'count'],
188 "verifyFossl16L335 FAILED! the baseline count {$licenseCounts[$key]} does" .
189 " not equal {$licFound['count']} for license $key,\n" .
190 "Expected: {$licenseCounts[$key]},\n" .
191 " Got: {$licFound['count']}\n");
195 $this->fail(
"verifyFossl16L335 A License was found that is " .
196 "not in the standard:\n$key\n");
Login($User=NULL, $Password=NULL)