function test3filesCopyright() { global $URL; global $name; global $safeName; // Note the entry: COPYRIGHT , // should really be: // // '* Copyright (c) 2002-2004 Sam Leffler, Errno Consulting, Atheros' => 1, // Likewise: copyrighted by Affero should be: // copyrighted by 278 Affero, Inc. // this string has ossolated between removing the id: and not // 'id: copyright v 1.2 / / : samleffler exp' => 1, $copyStd = array('copyright (c) free software foundation inc' => 1, 'copyright (c) free software foundation inc. made with' => 1, 'copyright (c) sam leffler errno consulting atheros' => 1, 'copyright v 1.2 / / : samleffler exp' => 1, 'copyright (c) <year> <name of author' => 1, 'copyright affero inc' => 1); print "starting Verify3filesCopyright test\n"; $page = $this->mybrowser->clickLink('Browse'); $this->assertTrue($this->myassertText($page, '/Browse/'), "verify3files FAILED! Could not find Browse menu\n"); $page = $this->mybrowser->clickLink('Copyright'); //print "************ Page after upload link *************\n$page\n"; $this->assertTrue($this->myassertText($page, "/Browse/"), "verify3files FAILED! Browse Title not found\n"); $this->assertTrue($this->myassertText($page, "/{$safeName}/"), "verify3files FAILED! did not find {$name}\n"); $this->assertTrue($this->myassertText($page, "/>View</"), "verify3files FAILED! >View< not found\n"); $this->assertTrue($this->myassertText($page, "/>Info</"), "verify3files FAILED! >Info< not found\n"); $this->assertTrue($this->myassertText($page, "/>Download</"), "verify3files FAILED! >Download< not found\n"); /* Select archive */ $page = $this->mybrowser->clickLink($name); $page = $this->mybrowser->clickLink('3files.tar'); //print "************ Page after select foss archive *************\n$page\n"; $this->assertTrue($this->myassertText($page, "/Affero-v1\\.0/"), "verify3files FAILED! '3files/' not found\n"); $this->assertTrue($this->myassertText($page, "/3 items/"), "verify3files FAILED! '3 items' not found\n"); /* Select the Copyright/Email/URL link */ $mini = new parseMiniMenu($page); $miniMenu = $mini->parseMiniMenu(); $url = makeUrl($this->host, $miniMenu['Copyright/Email/URL']); if ($url === NULL) { $this->fail("FATAL! verify3files Failed, host is not set or url " . "cannot be made, Stopping this test"); exit(1); } $page = $this->mybrowser->get($url); //print "page after get of $url is:\n$page\n"; $this->assertTrue($this->myassertText($page, '/Copyright\\/Email\\/URL Browser/'), "verify3files FAILED! Copyright/Email/URL Browser Title not found\n"); $this->assertTrue($this->myassertText($page, '/Total Copyrights: 6/'), "verify3files FAILED! Total copyrights does not equal 6\n"); $this->assertTrue($this->myassertText($page, '/Unique Copyrights: 6/'), "verify3files FAILED! Unique Copyrights does not equal 6\n"); // get the count, show links and text or link $copyR = new domParseLicenseTbl($page, 'copyright'); $copyR->parseLicenseTbl(); if (empty($copyR->hList)) { $this->fail("FATAL! table with id=copyright was not found on" . "the page, nothing to process, stopping test\n"); exit(1); } //print "entries in the table:\n";print_r($copyR->hList) . "\n"; // Verify text and counts are correct $notFound = array(); $found = NULL; foreach ($copyR->hList as $copyFound) { $key = $copyFound['textOrLink']; if (array_key_exists($key, $copyStd)) { $this->pass("Pass: found {$key} in copyright table\n"); $found = 1; // found one, check the count $foundCount = $copyFound['count']; $count = $copyStd[$key]; $this->assertEqual($count, $foundCount, "verify3files FAILED! the counts are not equal\n\n Expected:{$count}\nGot:{$foundCount}\n"); continue; } else { $notFound[] = $key; } } // foreach $copyR-> //} // foreach $copyStd // this is a hack for now... should be a better way to filter // Try in_array before insert? $uniqueNF = array(); $uniqueNF = array_unique($notFound); if (!empty($uniqueNF)) { $this->fail("verify3files FAILED! the following items did not" . " match any standard, are any false positives?:\n"); print "\n"; foreach ($uniqueNF as $falsePos) { print "{$falsePos}\n---------------------\n"; } } $email = new domParseLicenseTbl($page, 'copyrightemail'); $email->parseLicenseTbl(); // empty table?, verify counts are zero if ($email->noRows) { $this->assertTrue($this->myassertText($page, '/Total Emails: 0/'), "verify3files FAILED! Total Emails does not equal 0\n"); $this->assertTrue($this->myassertText($page, '/Unique Emails: 0/'), "verify3files FAILED! Unique Emails does not equal 0\n"); } else { if (empty($email->hList)) { $this->fail("FATAL! table with id=copyrightemail was not found on" . "the page, nothing to process, stopping test\n"); exit(1); } } $urls = new domParseLicenseTbl($page, 'copyrighturl'); $urls->parseLicenseTbl(); // empty table?, verify counts are zero if ($urls->noRows) { $this->assertTrue($this->myassertText($page, '/Total URLs: 0/'), "verify3files FAILED! Total URL's does not equal 0\n"); $this->assertTrue($this->myassertText($page, '/Unique URLs: 0/'), "verify3files FAILED! Unique URL's does not equal 0\n"); } else { if (empty($urls->hList)) { $this->fail("FATAL! table with id=copyrighturl was not found on" . "the page, nothing to process, stopping test\n"); exit(1); } } }
function testLicTbl() { global $URL; global $name; global $safeName; print "starting print lics\n"; $page = $this->mybrowser->clickLink('Browse'); $this->assertTrue($this->myassertText($page, '/Browse/'), "verifySimpleTest FAILED! Could not find Browse menu\n"); $this->assertTrue($this->myassertText($page, "/Browse/"), "verifySimpleTest FAILED! Browse Title not found\n"); $this->assertTrue($this->myassertText($page, "/{$safeName}/"), "verifySimpleTest FAILED! did not find {$name}\n"); $this->assertTrue($this->myassertText($page, "/>View</"), "verifySimpletest FAILED! >View< not found\n"); $this->assertTrue($this->myassertText($page, "/>Info</"), "verifySimpletest FAILED! >Info< not found\n"); $this->assertTrue($this->myassertText($page, "/>Download</"), "verifySimpletest FAILED! >Download< not found\n"); /* Select archive */ $page = $this->mybrowser->clickLink('Testing'); $page = $this->mybrowser->clickLink($name); //print "************ Page after select RedHat.tar *************\n$page\n"; $this->assertTrue($this->myassertText($page, "/1 item/"), "verifySimpletest FAILED! '1 item' not found\n"); $this->assertTrue($this->myassertText($page, "/RedHat/"), "verifySimpletest FAILED! 'RedHat' not found\n"); $page = $this->mybrowser->clickLink('RedHat/'); //print "************ Page after select RedHat Link *************\n$page\n"; /* Select the link to get copyright info */ $mini = new parseMiniMenu($page); $miniMenu = $mini->parseMiniMenu(); //print "MiniMenu is:\n";print_r($miniMenu) . "\n"; $url = makeUrl($this->host, $miniMenu['Nomos License']); if ($url === NULL) { $this->fail("RHEL Lics Failed, host/URL is not set"); } $page = $this->mybrowser->get($url); // get the 'Show' links and License color links $ct = new domParseLicenseTbl($page, 'lichistogram'); $ct->parseLicenseTbl(); // empty table? Error if ($ct->noRows) { $this->fail("Error! table with id=copyright has no rows!" . " nothing to process, There should be!\n"); } else { if (empty($ct->hList)) { $this->fail("Error! table with id=copyright was not found on" . "the page, There should be one\n"); } else { $total = 0; print "\$copyStd = array(\n"; foreach ($ct->hList as $list) { $cs = cleanString($list['textOrLink']); print " '{$cs}' => {$list['count']},\n"; $total += (int) $list['count']; } print ");\n"; } } }
function testVerifyFossology() { global $URL; global $name; global $safeName; $licenseSummary = array('Unique licenses' => 0, 'Licenses found' => 0, 'Files with no licenses' => 0, 'Files' => 0); print "starting verifyFossDirsOnly test\n"; $page = $this->mybrowser->clickLink('Browse'); $this->assertTrue($this->myassertText($page, '/Browse/'), "verifyFossDirsOnly FAILED! Could not find Browse menu\n"); //print "************ Page after upload link *************\n$page\n"; $this->assertTrue($this->myassertText($page, "/{$safeName}/"), "verifyFossDirsOnly FAILED! did not find {$name}\n"); $this->assertTrue($this->myassertText($page, "/>View</"), "verifyFossDirsOnly FAILED! >View< not found\n"); $this->assertTrue($this->myassertText($page, "/>Info</"), "verifyFossDirsOnly FAILED! >Info< not found\n"); $this->assertTrue($this->myassertText($page, "/>Download</"), "verifyFossDirsOnly FAILED! >Download< not found\n"); /* Select archive */ $page = $this->mybrowser->clickLink($name); //print "************ Page after select foss archive *************\n$page\n"; $this->assertTrue($this->myassertText($page, "/empty\\//"), "verifyFossDirsOnly FAILED! 'empty/' not found\n"); $this->assertTrue($this->myassertText($page, "/1 item/"), "verifyFossDirsOnly FAILED! '1 item' not found\n"); /* Select empty link */ $page = $this->mybrowser->clickLink('empty/'); /* need to check that there are 9 items */ $this->assertTrue($this->myassertText($page, "/9 items/"), "verifyFossDirsOnly FAILED! '9 items' not found\n"); $this->assertTrue($this->myassertText($page, "/agents/"), "verifyFossDirsOnly FAILED! did not find 'agents' directory\n"); $this->assertTrue($this->myassertText($page, "/scheduler/"), "verifyFossDirsOnly FAILED! did not find scheduler directory\n"); /* Select the License link to View License Historgram */ $mini = new parseMiniMenu($page); $miniMenu = $mini->parseMiniMenu(); $url = makeUrl($this->host, $miniMenu['Nomos License']); if ($url === NULL) { $this->fail("verifyFossDirsOnly Failed, host is not set"); } $page = $this->mybrowser->get($url); //print "page after get of $url is:\n$page\n"; $this->assertTrue($this->myassertText($page, '/Nomos License Browser/'), "verifyFossDirsOnly FAILED! Nomos License Browser Title not found\n"); $licSummary = new domParseLicenseTbl($page, 'licsummary', 0); $licSummary->parseLicenseTbl(); foreach ($licSummary->hList as $summary) { $key = $summary['textOrLink']; $this->assertEqual($licenseSummary[$key], $summary['count'], "verifyFossDirsOnly FAILED! {$key} does not equal {$licenseSummary[$key]},\n \t\tgot {$summary['count']}\n"); //print "summary is:\n";print_r($summary) . "\n"; } $dList = new parseLicenseTblDirs($page); $dirList = $dList->parseLicenseTblDirs(); /* * the directiory agents has 13 subdirectories all other directories * are empty. we are going to loop through them, but for now just * test a few of them out.... */ $url = makeUrl($this->host, $dirList['scheduler/']); $page = $this->mybrowser->get($url); //print "page after scheduler is:\n$page\n"; $folders = new parseFolderPath($page, $url); $dirCnt = $folders->countFiles(); // should only get one folder path) $this->assertEqual((int) $dirCnt, 1, "verifyFossDirsOnly FAILED! did not get 1 folder path back, got {$dirCnt} instead\n"); // every entry but the last must have a non-null value (we assume parse // routine worked) $fpaths = $folders->parseFolderPath(); $this->assertTrue($this->check4Links($fpaths), "verifyFossDirsOnly FAILED! something wrong with folder path\n" . "See this url:\n{$url}\n"); }
function testVerifyFossl16L335() { global $URL; global $name; global $safeName; // licenseCounts recorded 2010-11-19 for release 1.3 $licenseCounts = array('GPL_v2' => 224, 'No_license_found' => 72, 'GPL' => 23, 'LGPL_v2.1' => 17, 'Apache_v2.0' => 2, 'GFDL' => 2, 'Public-domain' => 8, 'APSL_v2.0' => 1, 'Artistic' => 1, 'Boost' => 1, 'BSD' => 1, 'FSF-possibility' => 1, 'GPL_v2-possibility' => 1, 'LGPL_v2.1+' => 1, 'LGPL_v3+' => 1, 'NPL' => 1, 'OSL_v3.0' => 1, 'PHP-possibility' => 1, 'Python' => 1, 'See-doc(OTHER)' => 1, 'X11-possibility' => 1, 'Zope' => 1); $licenseSummary = array('Unique licenses' => 22, 'Licenses found' => 291, 'Files with no licenses' => 72, 'Files' => 345); print "starting VerifyFossl16L335 test\n"; $page = $this->mybrowser->clickLink('Browse'); $this->assertTrue($this->myassertText($page, '/Browse/'), "verifyFossl16L335 FAILED! Could not find Browse menu\n"); /* Testing folder */ $page = $this->mybrowser->clickLink('Testing'); //print "************ Page after upload link *************\n$page\n"; $this->assertTrue($this->myassertText($page, "/Browse/"), "verifyFossl16L335 FAILED! Browse Title not found\n"); $this->assertTrue($this->myassertText($page, "/{$safeName}/"), "verifyFossl16L335 FAILED! did not find {$name}\n"); $this->assertTrue($this->myassertText($page, "/>View</"), "verifyFossl16L335 FAILED! >View< not found\n"); $this->assertTrue($this->myassertText($page, "/>Info</"), "verifyFossl16L335 FAILED! >Info< not found\n"); $this->assertTrue($this->myassertText($page, "/>Download</"), "verifyFossl16L335 FAILED! >Download< not found\n"); /* Select archive */ $page = $this->mybrowser->clickLink($name); //print "************ Page after select foss archive *************\n$page\n"; $this->assertTrue($this->myassertText($page, "/fossI16L335U29\\.tar/"), "FAILURE! Could not find fossI16L335U29.tar link\n"); /* Select fossology link */ $page = $this->mybrowser->clickLink('fossI16L335U29.tar'); $page = $this->mybrowser->clickLink('fossology/'); /* need to check that there are 16 items */ /* check that all the [xxx] items add to 335 */ $this->assertTrue($this->myassertText($page, "/Makefile/")); $this->assertTrue($this->myassertText($page, "/mkcheck\\.sh/"), "FAIL! did not find mkcheck.sh\n"); $this->assertTrue($this->myassertText($page, "/>View</"), "FAIL! >View< not found\n"); $this->assertTrue($this->myassertText($page, "/>Info</"), "FAIL! >Info< not found\n"); $this->assertTrue($this->myassertText($page, "/>Download</"), "FAIL! >Download< not found\n"); /* Select the License link to View License Historgram */ $mini = new parseMiniMenu($page); $miniMenu = $mini->parseMiniMenu(); $url = makeUrl($this->host, $miniMenu['License Browser']); if ($url === NULL) { $this->fail("verifyFossl16L335 Failed, host/url is not set"); } $page = $this->mybrowser->get($url); //print "page after get of $url is:\n$page\n"; $this->assertTrue($this->myassertText($page, '/License Browser/'), "verifyFossl16L335 FAILED! Nomos License Browser Title not found\n"); // check that license summarys are correct $licSummary = new domParseLicenseTbl($page, 'licsummary', 0); $licSummary->parseLicenseTbl(); foreach ($licSummary->hList as $summary) { $key = $summary['textOrLink']; $this->assertEqual($licenseSummary[$key], $summary['count'], "verifyFossl16L335 FAILED! {$key} does not equal {$licenseSummary[$key]},\n \t\tgot {$summary['count']}\n"); //print "summary is:\n";print_r($summary) . "\n"; } // get the license names and 'Show' links $licHistogram = new domParseLicenseTbl($page, 'lichistogram', 1); $licHistogram->parseLicenseTbl(); if ($licHistogram->noRows === TRUE) { $this->fail("FATAL! no table rows to process, there should be many for" . " this test, Stopping the test"); return; } // verify every row against the standard by comparing the counts. /* * @todo check the show links, but to do that, need to gather another * standard array to match against or just use the count from the * baseline? */ foreach ($licHistogram->hList as $licFound) { $key = $licFound['textOrLink']; //print "VDB: key is:$key\n"; //print "licFound is:\n";print_r($licFound) . "\n"; if (array_key_exists($key, $licenseCounts)) { $this->assertEqual($licenseCounts[$key], $licFound['count'], "verifyFossl16L335 FAILED! the baseline count {$licenseCounts[$key]} does" . " not equal {$licFound['count']} for license {$key},\n" . "Expected: {$licenseCounts[$key]},\n" . " Got: {$licFound['count']}\n"); } else { $this->fail("verifyFossl16L335 A License was found that is " . "not in the standard:\n{$key}\n"); } } }
function testVerifyFossology() { global $URL; global $name; global $safeName; $licenseSummary = array('Unique licenses' => 1, 'Licenses found' => 1, 'Files with no licenses' => 0, 'Files' => 1); print "starting VerifyFoss23D1F1L test\n"; $page = $this->mybrowser->clickLink('Browse'); $this->assertTrue($this->myassertText($page, '/Browse/'), "verify23D1F1L FAILED! Could not find Browse menu\n"); $page = $this->mybrowser->clickLink('Testing'); //print "************ Page after upload link *************\n$page\n"; $this->assertTrue($this->myassertText($page, "/Browse/"), "verify23D1F1L FAILED! Browse Title not found\n"); $this->assertTrue($this->myassertText($page, "/{$safeName}/"), "verify23D1F1L FAILED! did not find {$name}\n"); $this->assertTrue($this->myassertText($page, "/>View</"), "verifyfoss23D1F1L FAILED! >View< not found\n"); $this->assertTrue($this->myassertText($page, "/>Info</"), "verifyFoss23D1F1L FAILED! >Info< not found\n"); $this->assertTrue($this->myassertText($page, "/>Download</"), "verifyFoss23D1F1L FAILED! >Download< not found\n"); /* Select archive */ $page = $this->mybrowser->clickLink($name); //print "************ Page after select foss archive *************\n$page\n"; $this->assertTrue($this->myassertText($page, "/foss23Dirs1File1Lic\\//"), "verifyfoss23D1F1L FAILED! 'foss23Dirs1File1Lic/' not found\n"); $this->assertTrue($this->myassertText($page, "/1 item/"), "verifyfoss23D1F1L FAILED! '1 item' not found\n"); /* Select fossology link */ $page = $this->mybrowser->clickLink('foss23Dirs1File1Lic/'); /* need to check that there are 9 items */ $this->assertTrue($this->myassertText($page, "/9 items/"), "verifyfoss23D1F1L FAILED! '9 items' not found\n"); $this->assertTrue($this->myassertText($page, "/agents/"), "verify23D1F1L FAILED! did not find 'agents' directory\n"); $this->assertTrue($this->myassertText($page, "/scheduler/"), "verify23D1F1L FAILED! did not find scheduler directory\n"); /* Select the License link to View License Historgram */ $mini = new parseMiniMenu($page); $miniMenu = $mini->parseMiniMenu(); $url = makeUrl($this->host, $miniMenu['Nomos License']); if ($url === NULL) { $this->fail("verify23D1F1L Failed, host is not set"); } $page = $this->mybrowser->get($url); //print "page after get of $url is:\n$page\n"; $this->assertTrue($this->myassertText($page, '/Nomos License Browser/'), "verify23D1F1L FAILED! License Browser Title not found\n"); // verify license summaries $licSummary = new domParseLicenseTbl($page, 'licsummary', 0); $licSummary->parseLicenseTbl(); foreach ($licSummary->hList as $summary) { $key = $summary['textOrLink']; $this->assertEqual($licenseSummary[$key], $summary['count'], "verifyFossDirsOnly FAILED! {$key} does not equal {$licenseSummary[$key]},\n \t\tgot {$summary['count']}\n"); //print "summary is:\n";print_r($summary) . "\n"; } // get the 'Show' links and License color links $licHisto = new domParseLicenseTbl($page, 'lichistogram'); $licHisto->parseLicenseTbl(); if (empty($licHisto->hList)) { $this->fail("FATAL! table with id=lichistogram was not found on\n\t\t\t\t\t\t\t\t\tthe page, nothing to process, stopping test\n"); exit(1); } /* Select show 'GPL_v2', verify */ $gplv2URL = makeUrl($this->host, $licHisto->hList[1]['showLink']); $page = $this->mybrowser->get($gplv2URL); $licFileList = new parseFolderPath($page, $URL); $tblList = $licFileList->parseFolderPath(); $fileCnt = count($tblList); print "Checking the number of files based on 'GPL_v2'\n"; $this->assertTrue($fileCnt == 1, "FAILURE! Should only have 1 file with a GPL_v2 license: " . "Testing/foss23D1F1L.bz2/foss23Dirs1File1Lic/cli/cp2foss.php, " . "got:{$fileCnt}\n"); }
function testRHEL() { global $URL; $licBaseLine = array('No_license_found' => 6878, 'Apache_v2.0' => 858, 'ATT' => 812, 'GPL_v2+' => 289, 'CMU' => 247, 'FSF' => 176, 'BSD-style' => 154, 'LGPL' => 131, 'GPL_v3+' => 76, 'Apache-possibility' => 62, 'See-doc(OTHER)' => 28, 'Debian-SPI-style' => 34, 'GNU-Manpages' => 34, 'LGPL_v2.1+' => 29, 'MPL_v1.1' => 29, 'Trademark-ref' => 25, 'IETF' => 28, 'UnclassifiedLicense' => 28, 'GPL-exception' => 24, 'BSD' => 20, 'Apache' => 17, 'GPL' => 73, 'GPL_v2' => 13, 'GPL_v2.1+' => 1, 'Indemnity' => 2, 'GPL-possibility' => 1, 'Public-domain' => 20, 'Non-commercial!' => 6, 'RSA-Security' => 7, 'ATT-possibility' => 6, 'LGPL_v2+' => 6, 'OSL_v1.0' => 6, 'CPL_v1.0' => 5, 'GFDL_v1.1+' => 5, 'GPL_v3' => 5, 'Intel' => 5, 'LGPL_v3+' => 4, 'Public-domain-ref' => 4, 'Perl-possibility' => 4, 'APSL_v1.1' => 3, 'IOS' => 3, 'MIT-style' => 3, 'NOT-public-domain' => 10, 'Apache_v1.1' => 3, 'CMU-possibility' => 2, 'GFDL_v1.1' => 3, 'GFDL_v1.2+' => 3, 'MIT' => 2, 'MPL' => 2, 'Open-Publication_v1.0' => 2, 'Zope-PL_v2.0' => 2, 'AGFA(RESTRICTED)' => 1, 'APSL' => 1, 'APSL_v1.2' => 1, 'ATT-Source_v1.2d' => 1, 'BSD-possibility' => 1, 'CCA' => 1, 'Dyade' => 1, 'HP-possibility' => 1, 'ISC' => 1, 'GPL-Bison-exception' => 1, 'LGPL-possibility' => 1, 'LGPL_v2' => 1, 'MacroMedia-RPSL' => 1, 'Microsoft-possibility' => 1, 'NPL_v1.1' => 1, 'RedHat-EULA' => 1, 'RedHat(Non-commercial)' => 1, 'Same-license-as' => 1, 'See-file(COPYING)' => 1, 'Sun' => 1, 'Sun-BCLA' => 1, 'Sun-possibility' => 1, 'Sun(RESTRICTED)' => 1, 'TeX-exception' => 1, 'U-Wash(Free-Fork)' => 1, 'X11' => 1, 'zlib/libpng' => 1); $licenseSummary = array('Unique licenses' => 71, 'Licenses found' => 3328, 'Files with no licenses' => 6878, 'Files' => 12595); print "starting testRHEL\n"; $name = 'RedHat.tar.gz'; $safeName = escapeDots($name); //print "safeName is:$safeName\n"; $page = $this->mybrowser->clickLink('Browse'); $page = $this->mybrowser->clickLink('Testing'); $this->assertTrue($this->myassertText($page, "/{$safeName}/"), "verifyRedHat FAILED! did not find {$safeName}\n"); /* Select archive */ //print "CKZDB: page before call parseBMenu:\n$page\n"; $page = $this->mybrowser->clickLink($name); $this->assertTrue($this->myassertText($page, "/1 item/"), "verifyRedHat FAILED! 1 item not found\n"); $page = $this->mybrowser->clickLink('RedHat.tar'); //print "page after clicklink RedHat.tar:\n$page\n"; $page = $this->mybrowser->clickLink('RedHat/'); //print "page after clicklink RedHat:\n$page\n"; $this->assertTrue($this->myassertText($page, "/65 items/"), "verifyRedHat FAILED! '65 items' not found\n"); $mini = new parseMiniMenu($page); $miniMenu = $mini->parseMiniMenu(); //print "miniMenu is:\n";print_r($miniMenu) . "\n"; $url = makeUrl($this->host, $miniMenu['License Browser']); if ($url === NULL) { $this->fail("verifyRedHat Failed, host/url is not set"); } $page = $this->mybrowser->get($url); //print "page after get of $url is:\n$page\n"; $this->assertTrue($this->myassertText($page, '/License Browser/'), "verifyRedHat FAILED! License Browser Title not found\n"); // check that license summarys are correct $licSummary = new domParseLicenseTbl($page, 'licsummary', 0); $licSummary->parseLicenseTbl(); print "verifying summaries....\n"; foreach ($licSummary->hList as $summary) { //print "summary is:\n";print_r($summary) . "\n"; $key = $summary['textOrLink']; //print "SUM: key is:$key\n"; $this->assertEqual($licenseSummary[$key], $summary['count'], "verifyRedHat FAILED! {$key} does not equal {$licenseSummary[$key]},\n Expected: {$licenseSummary[$key]},\n Got: {$summary['count']}\n"); //print "summary is:\n";print_r($summary) . "\n"; } // get the license names and 'Show' links $licHistogram = new domParseLicenseTbl($page, 'lichistogram', 1); $licHistogram->parseLicenseTbl(); if ($licHistogram->noRows === TRUE) { $this->fail("FATAL! no table rows to process, there should be many for" . " this test, Stopping the test"); return; } // verify every row against the standard by comparing the counts. /* * @todo check the show links, but to do that, need to gather another * standard array to match agains? or just use the count from the * baseline? */ //print "table is:\n";print_r($licHistogram->hList) . "\n"; foreach ($licHistogram->hList as $licFound) { $key = $licFound['textOrLink']; //print "HDB: key is:$key\n"; //print "licFound is:\n";print_r($licFound) . "\n"; if (array_key_exists($key, $licBaseLine)) { //print "licFound[textOrLink] is:{$licFound['textOrLink']}\n"; $this->assertEqual($licBaseLine[$key], $licFound['count'], "verifyRedHat FAILED! the baseline count {$licBaseLine[$key]} does" . " not equal {$licFound['count']} for license {$key},\n" . "Expected: {$licBaseLine[$key]},\n" . " Got: {$licFound['count']}\n"); } else { $this->fail("verifyRedHat FAILED! A License was found that is " . "not in the standard:\n{$key}\n"); } } }