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');
21 require_once(
'../../../tests/testClasses/parseLicenseTbl.php');
22 require_once(
'../../../tests/testClasses/dom-parseLicenseTable.php');
23 require_once(
'../../../tests/testClasses/parseLicenseTblDirs.php');
46 print
"starting verifyFossDirsOnly-SetUp\n";
47 $name =
'fossDirsOnly.tar.bz2';
48 $safeName = escapeDots($name);
49 $this->host = getHost($URL);
53 $page = $this->mybrowser->get($URL);
54 $page = $this->mybrowser->clickLink(
'Browse');
55 $this->assertTrue($this->myassertText($page,
'/Browse/'),
56 "verifyDirsOnly FAILED! Could not find Browse menu\n");
57 $result = $this->myassertText($page,
"/$safeName/");
59 $this->fail(
"Failure, cannot find archive $name, Stopping test\n");
64 function testVerifyFossology()
70 $licenseSummary = array(
71 'Unique licenses' => 0,
72 'Licenses found' => 0,
73 'Files with no licenses' => 0,
77 print
"starting verifyFossDirsOnly test\n";
78 $page = $this->mybrowser->clickLink(
'Browse');
79 $this->assertTrue($this->myassertText($page,
'/Browse/'),
80 "verifyFossDirsOnly FAILED! Could not find Browse menu\n");
82 $this->assertTrue($this->myassertText($page,
"/$safeName/"),
83 "verifyFossDirsOnly FAILED! did not find $name\n");
84 $this->assertTrue($this->myassertText($page,
"/>View</"),
85 "verifyFossDirsOnly FAILED! >View< not found\n");
86 $this->assertTrue($this->myassertText($page,
"/>Info</"),
87 "verifyFossDirsOnly FAILED! >Info< not found\n");
88 $this->assertTrue($this->myassertText($page,
"/>Download</"),
89 "verifyFossDirsOnly FAILED! >Download< not found\n");
92 $page = $this->mybrowser->clickLink($name);
94 $this->assertTrue($this->myassertText($page,
"/empty\//"),
95 "verifyFossDirsOnly FAILED! 'empty/' not found\n");
96 $this->assertTrue($this->myassertText($page,
"/1 item/"),
97 "verifyFossDirsOnly FAILED! '1 item' not found\n");
100 $page = $this->mybrowser->clickLink(
'empty/');
103 $this->assertTrue($this->myassertText($page,
"/9 items/"),
104 "verifyFossDirsOnly FAILED! '9 items' not found\n");
105 $this->assertTrue($this->myassertText($page,
"/agents/"),
106 "verifyFossDirsOnly FAILED! did not find 'agents' directory\n");
107 $this->assertTrue($this->myassertText($page,
"/scheduler/"),
108 "verifyFossDirsOnly FAILED! did not find scheduler directory\n");
112 $miniMenu = $mini->parseMiniMenu();
113 $url = makeUrl($this->host, $miniMenu[
'Nomos License']);
114 if($url === NULL) { $this->fail(
"verifyFossDirsOnly Failed, host is not set"); }
116 $page = $this->mybrowser->get($url);
118 $this->assertTrue($this->myassertText($page,
'/Nomos License Browser/'),
119 "verifyFossDirsOnly FAILED! Nomos License Browser Title not found\n");
122 $licSummary->parseLicenseTbl();
124 foreach ($licSummary->hList as $summary) {
125 $key = $summary[
'textOrLink'];
126 $this->assertEqual($licenseSummary[$key], $summary[
'count'],
127 "verifyFossDirsOnly FAILED! $key does not equal $licenseSummary[$key],
128 got $summary[count]\n");
133 $dirList = $dList->parseLicenseTblDirs();
139 $url = makeUrl($this->host, $dirList[
'scheduler/']);
140 $page = $this->mybrowser->get($url);
143 $dirCnt = $folders->countFiles();
145 $this->assertEqual((
int)$dirCnt, 1,
146 "verifyFossDirsOnly FAILED! did not get 1 folder path back, got $dirCnt instead\n");
149 $fpaths = $folders->parseFolderPath();
151 "verifyFossDirsOnly FAILED! something wrong with folder path\n" .
152 "See this url:\n$url\n");
168 $flistSize = count($folderPath[0]);
169 foreach($folderPath as $flist)
172 foreach($flist as $folder => $link)
176 if ($i == $flistSize)
178 $this->assertTrue(is_null($link),
179 "verifyFossDirsOnly FAILED! Last entry is not null\n$folder $link\n");
182 $this->assertFalse(is_null($link),
183 "verifyFossDirsOnly FAILED! Found a folder with no link\n$folder $link\n");
Login($User=NULL, $Password=NULL)