protected function setUp() { $this->controller = TEST_APP . '/public_html/index.php'; parent::setUp(); }
$manager->execute($job); // Cycle over all ExtractionGroups $testResult = "Logfile for DBpedia Data Extraction (" . date("D M j Y G:i:s T") . ")\n"; // Cycle over all ExtractionGroups foreach ($job->getExtractionGroups() as $currentGroup) { // Cycle over all extractors foreach ($currentGroup->getExtractors() as $extractor) { $testResult .= "\nResults for: " . $extractor->getExtractorID() . "\n"; foreach ($sourceFiles as $key => $page) { // Only get files, which are available for the extractor if (!isset($resultFiles[$extractor->getExtractorID()][$key])) { continue; } $currentResult = trim($currentGroup->getDestination()->getExtractionResult($page)); $expectedResult = trim(file_get_contents($resultFiles[$extractor->getExtractorID()][$key])); $testUnit = new TestUnit($currentResult, $expectedResult); $testResult .= "\n{$page}: "; if ($testUnit->compare()) { $testResult .= "PASSED."; } else { $testResult .= "FAILED.\nErrors: " . $testUnit->getErrorCount() . "\n" . $testUnit->getErrors(); } } } } echo $testResult; $testResultHTML = "<html>\n" . "<head>\n<style>\n" . "body { font-family:sans-serif; font-size:13px; }\n" . ".passed {color:green;}\n" . ".failed {color:red;}\n" . "</style>\n" . "<title>DBpedia Extraction Test" . date("D M j Y G:i:s T") . "</title>\n</head>\n<body>"; $testResultHTML .= str_replace("\n", "<br />", htmlspecialchars($testResult)); $testResultHTML = str_replace("PASSED", "<span class=\"passed\">PASSED</span>", $testResultHTML); $testResultHTML = str_replace("FAILED", "<span class=\"failed\">FAILED</span>", $testResultHTML); $testResultHTML .= "\n</body>\n</html>";
fail</strong>. Exactly those with <code>pass</code> in their name should succeed. </p> <p> For each test we display both the test result -- <span class="Pass">ok</span>, <span class="Failure">FAIL</span>, or <span class="Error">ERROR</span> -- and also a meta-result -- <span class="Expected">as expected</span>, <span class="Unexpected">UNEXPECTED</span>, or <span class="Unknown">unknown</span> -- that indicates whether the expected test result occurred. Although many test results will be 'FAIL' here, all meta-results should be 'as expected', except for a few 'unknown' meta-results (because of errors) when running in PHP3. </p> <h2>Tests</h2> <?php $testcases = array('HTML_Progress_TestCase_addListener', 'HTML_Progress_TestCase_DM_new', 'HTML_Progress_TestCase_DM_setIncrement', 'HTML_Progress_TestCase_DM_setMaximum', 'HTML_Progress_TestCase_DM_setMinimum', 'HTML_Progress_TestCase_DM_setValue', 'HTML_Progress_TestCase_getDM', 'HTML_Progress_TestCase_getString', 'HTML_Progress_TestCase_getUI', 'HTML_Progress_TestCase_removeListener', 'HTML_Progress_TestCase_setAnimSpeed', 'HTML_Progress_TestCase_setBorderPainted', 'HTML_Progress_TestCase_setDM', 'HTML_Progress_TestCase_setIndeterminate', 'HTML_Progress_TestCase_setModel', 'HTML_Progress_TestCase_setString', 'HTML_Progress_TestCase_setStringPainted', 'HTML_Progress_TestCase_setUI', 'HTML_Progress_TestCase_UI_getBorderAttributes', 'HTML_Progress_TestCase_UI_getCellAttributes', 'HTML_Progress_TestCase_UI_getProgressAttributes', 'HTML_Progress_TestCase_UI_getStringAttributes', 'HTML_Progress_TestCase_UI_new', 'HTML_Progress_TestCase_UI_setCellAttributes', 'HTML_Progress_TestCase_UI_setCellCoordinates', 'HTML_Progress_TestCase_UI_setCellCount', 'HTML_Progress_TestCase_UI_setFillWay', 'HTML_Progress_TestCase_UI_setOrientation', 'HTML_Progress_TestCase_UI_setScript'); $suite = new PHPUnit_TestSuite(); foreach ($testcases as $testcase) { include_once $testcase . '.php'; $suite->addTestSuite($testcase); } $listener = new HTML_TestListener(); $result = TestUnit::run($suite, $listener); $result->removeListener($listener); $result->report(); ?> </body> </html>