27 require_once(
'../../../tests/fossologyTestCase.php');
28 require_once(
'../../../tests/commonTestFuncs.php');
29 require_once(
'../../../tests/TestEnvironment.php');
30 require_once(
'../../../tests/testClasses/parseMiniMenu.php');
31 require_once(
'../../../tests/testClasses/parseFolderPath.php');
33 require_once(
'../../../tests/testClasses/dom-parseLicenseTable.php');
52 $name =
'fossI16L335U29.tar.bz2';
53 $safeName = escapeDots($name);
54 $this->host = getHost($URL);
59 $page = $this->mybrowser->get($URL);
60 $page = $this->mybrowser->clickLink(
'Browse');
61 $this->assertTrue($this->myassertText($page,
'/Browse/'),
62 "verifyFossl16L335 FAILED! Could not find Browse menu\n");
63 $page = $this->mybrowser->clickLink(
'Testing');
64 $this->assertTrue($this->myassertText($page,
'/Testing/'),
65 "verifyFossl16L335 FAILED! Could not find Testing folder\n");
66 $result = $this->myassertText($page,
"/$safeName/");
67 if(!($result)) { exit(FALSE); }
70 function testVerifyFossl16L335()
77 $licenseCounts = array(
79 'No_license_found' => 72,
89 'FSF-possibility' => 1,
90 'GPL_v2-possibility' => 1,
95 'PHP-possibility' => 1,
97 'See-doc(OTHER)' => 1,
98 'X11-possibility' => 1,
102 $licenseSummary = array(
103 'Unique licenses'=> 22,
104 'Licenses found'=> 291,
105 'Files with no licenses'=> 72,
109 print
"starting VerifyFossl16L335 test\n";
110 $page = $this->mybrowser->clickLink(
'Browse');
111 $this->assertTrue($this->myassertText($page,
'/Browse/'),
112 "verifyFossl16L335 FAILED! Could not find Browse menu\n");
114 $page = $this->mybrowser->clickLink(
'Testing');
116 $this->assertTrue($this->myassertText($page,
"/Browse/"),
117 "verifyFossl16L335 FAILED! Browse Title not found\n");
118 $this->assertTrue($this->myassertText($page,
"/$safeName/"),
119 "verifyFossl16L335 FAILED! did not find $name\n");
120 $this->assertTrue($this->myassertText($page,
"/>View</"),
121 "verifyFossl16L335 FAILED! >View< not found\n");
122 $this->assertTrue($this->myassertText($page,
"/>Info</"),
123 "verifyFossl16L335 FAILED! >Info< not found\n");
124 $this->assertTrue($this->myassertText($page,
"/>Download</"),
125 "verifyFossl16L335 FAILED! >Download< not found\n");
128 $page = $this->mybrowser->clickLink($name);
130 $this->assertTrue($this->myassertText($page,
"/fossI16L335U29\.tar/"),
131 "FAILURE! Could not find fossI16L335U29.tar link\n");
134 $page = $this->mybrowser->clickLink(
'fossI16L335U29.tar');
135 $page = $this->mybrowser->clickLink(
'fossology/');
140 $this->assertTrue($this->myassertText($page,
"/Makefile/"));
141 $this->assertTrue($this->myassertText($page,
"/mkcheck\.sh/"),
142 "FAIL! did not find mkcheck.sh\n");
143 $this->assertTrue($this->myassertText($page,
"/>View</"),
144 "FAIL! >View< not found\n");
145 $this->assertTrue($this->myassertText($page,
"/>Info</"),
146 "FAIL! >Info< not found\n");
147 $this->assertTrue($this->myassertText($page,
"/>Download</"),
148 "FAIL! >Download< not found\n");
152 $miniMenu = $mini->parseMiniMenu();
153 $url = makeUrl($this->host, $miniMenu[
'License Browser']);
154 if($url === NULL) { $this->fail(
"verifyFossl16L335 Failed, host/url is not set"); }
156 $page = $this->mybrowser->get($url);
158 $this->assertTrue($this->myassertText($page,
'/License Browser/'),
159 "verifyFossl16L335 FAILED! Nomos License Browser Title not found\n");
163 $licSummary->parseLicenseTbl();
165 foreach ($licSummary->hList as $summary) {
166 $key = $summary[
'textOrLink'];
167 $this->assertEqual($licenseSummary[$key], $summary[
'count'],
168 "verifyFossl16L335 FAILED! $key does not equal $licenseSummary[$key], 169 got $summary[count]\n");
175 $licHistogram->parseLicenseTbl();
177 if($licHistogram->noRows === TRUE)
179 $this->fail(
"FATAL! no table rows to process, there should be many for" 180 .
" this test, Stopping the test");
191 foreach($licHistogram->hList as $licFound)
193 $key = $licFound[
'textOrLink'];
196 if(array_key_exists($key,$licenseCounts))
198 $this->assertEqual($licenseCounts[$key], $licFound[
'count'],
199 "verifyFossl16L335 FAILED! the baseline count {$licenseCounts[$key]} does" .
200 " not equal {$licFound['count']} for license $key,\n" .
201 "Expected: {$licenseCounts[$key]},\n" .
202 " Got: {$licFound['count']}\n");
206 $this->fail(
"verifyFossl16L335 A License was found that is " .
207 "not in the standard:\n$key\n");
Login($User=NULL, $Password=NULL)