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');
32 require_once(
'../../../tests/testClasses/parseLicenseTbl.php');
33 require_once(
'../../../tests/testClasses/dom-parseLicenseTable.php');
34 require_once(
'../../../tests/testClasses/parseLicenseTblDirs.php');
57 print
"starting verifyFossDirsOnly-SetUp\n";
58 $name =
'fossDirsOnly.tar.bz2';
59 $safeName = escapeDots($name);
60 $this->host = getHost($URL);
64 $page = $this->mybrowser->get($URL);
65 $page = $this->mybrowser->clickLink(
'Browse');
66 $this->assertTrue($this->myassertText($page,
'/Browse/'),
67 "verifyDirsOnly FAILED! Could not find Browse menu\n");
68 $result = $this->myassertText($page,
"/$safeName/");
70 $this->fail(
"Failure, cannot find archive $name, Stopping test\n");
75 function testVerifyFossology()
81 $licenseSummary = array(
82 'Unique licenses' => 0,
83 'Licenses found' => 0,
84 'Files with no licenses' => 0,
88 print
"starting verifyFossDirsOnly test\n";
89 $page = $this->mybrowser->clickLink(
'Browse');
90 $this->assertTrue($this->myassertText($page,
'/Browse/'),
91 "verifyFossDirsOnly FAILED! Could not find Browse menu\n");
93 $this->assertTrue($this->myassertText($page,
"/$safeName/"),
94 "verifyFossDirsOnly FAILED! did not find $name\n");
95 $this->assertTrue($this->myassertText($page,
"/>View</"),
96 "verifyFossDirsOnly FAILED! >View< not found\n");
97 $this->assertTrue($this->myassertText($page,
"/>Info</"),
98 "verifyFossDirsOnly FAILED! >Info< not found\n");
99 $this->assertTrue($this->myassertText($page,
"/>Download</"),
100 "verifyFossDirsOnly FAILED! >Download< not found\n");
103 $page = $this->mybrowser->clickLink($name);
105 $this->assertTrue($this->myassertText($page,
"/empty\//"),
106 "verifyFossDirsOnly FAILED! 'empty/' not found\n");
107 $this->assertTrue($this->myassertText($page,
"/1 item/"),
108 "verifyFossDirsOnly FAILED! '1 item' not found\n");
111 $page = $this->mybrowser->clickLink(
'empty/');
114 $this->assertTrue($this->myassertText($page,
"/9 items/"),
115 "verifyFossDirsOnly FAILED! '9 items' not found\n");
116 $this->assertTrue($this->myassertText($page,
"/agents/"),
117 "verifyFossDirsOnly FAILED! did not find 'agents' directory\n");
118 $this->assertTrue($this->myassertText($page,
"/scheduler/"),
119 "verifyFossDirsOnly FAILED! did not find scheduler directory\n");
123 $miniMenu = $mini->parseMiniMenu();
124 $url = makeUrl($this->host, $miniMenu[
'Nomos License']);
125 if($url === NULL) { $this->fail(
"verifyFossDirsOnly Failed, host is not set"); }
127 $page = $this->mybrowser->get($url);
129 $this->assertTrue($this->myassertText($page,
'/Nomos License Browser/'),
130 "verifyFossDirsOnly FAILED! Nomos License Browser Title not found\n");
133 $licSummary->parseLicenseTbl();
135 foreach ($licSummary->hList as $summary) {
136 $key = $summary[
'textOrLink'];
137 $this->assertEqual($licenseSummary[$key], $summary[
'count'],
138 "verifyFossDirsOnly FAILED! $key does not equal $licenseSummary[$key], 139 got $summary[count]\n");
144 $dirList = $dList->parseLicenseTblDirs();
150 $url = makeUrl($this->host, $dirList[
'scheduler/']);
151 $page = $this->mybrowser->get($url);
154 $dirCnt = $folders->countFiles();
156 $this->assertEqual((
int)$dirCnt, 1,
157 "verifyFossDirsOnly FAILED! did not get 1 folder path back, got $dirCnt instead\n");
160 $fpaths = $folders->parseFolderPath();
162 "verifyFossDirsOnly FAILED! something wrong with folder path\n" .
163 "See this url:\n$url\n");
179 $flistSize = count($folderPath[0]);
180 foreach($folderPath as $flist)
183 foreach($flist as $folder => $link)
187 if ($i == $flistSize)
189 $this->assertTrue(is_null($link),
190 "verifyFossDirsOnly FAILED! Last entry is not null\n$folder $link\n");
193 $this->assertFalse(is_null($link),
194 "verifyFossDirsOnly FAILED! Found a folder with no link\n$folder $link\n");
Login($User=NULL, $Password=NULL)