summaryrefslogtreecommitdiff
path: root/tests/simpletests/testcase/coveragephpPgAdminMain.php
blob: 576631c90345c56e557079520a3ce0662c27a167 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
 * This is entrance to run all the test suites and generate a report for code coverage.
 *
 * @author     Augmentum SpikeSource Team 
 * @copyright  2005 by Augmentum, Inc.
 */

require_once 'simpletest.inc.php';
require_once 'simpletest/web_tester.php';
require_once 'simpletest/reporter.php';

// Import the language file for phpPgAdmi to avoid hard code.
require_once('lang/recoded/english.php');

require_once('Public/common.php');
require_once('Public/SetPrecondition.php');

// Creates GroupTest objects for running all the testcase.
require_once('Server/ServerGroupTest.php');
require_once('Databases/DatabaseGroupTest.php');
require_once('Schemas/SchemasGroupTest.php');
require_once('Tables/TableGroupTest.php');
require_once('Common/CommonGroupTest.php');

$testServer = &new ServerGroupTest();
$testDatabase = &new DatabaseGroupTest();
$testSchema = &new SchemasGroupTest();
$testTable = &new TableGroupTest();
$testCommon = &new CommonGroupTest();

require_once 'phpcoverage.inc.php';
require_once 'remote/RemoteCoverageRecorder.php';
require_once 'reporter/HtmlCoverageReporter.php';

// These variables will be set by the phpcoverage.inc.php
global $PHPCOVERAGE_REPORT_DIR, $PHPCOVERAGE_APPBASE_PATH;

$cov_weburl = $webUrl . "/phpcoverage.remote.top.inc.php";

// Initialize RemoteCoverageRecorder
file_get_contents($cov_weburl . "?phpcoverage-action=init&cov-file-name=" . 
                  urlencode("TestphpPgAdmin.xml") . "&tmp-dir=". urlencode("/tmp"));

// Run the simpletest test cases
$testServer->run(new TextReporter());
$testDatabase->run(new TextReporter());
$testSchema->run(new TextReporter());
$testTable->run(new TextReporter());
$testCommon->run(new TextReporter());

// Get the coverage data xml
$xml = file_get_contents($cov_weburl . "?phpcoverage-action=get-coverage-xml");

// Cleanup the recording
file_get_contents($cov_weburl . "?phpcoverage-action=cleanup");

$reporter = new HtmlCoverageReporter("phpPgAdmin Code coverage report","","$PHPCOVERAGE_REPORT_DIR");

// Sets the directories or file paths to be included in the code coverage recording.
$includePaths = array(realpath($PHPCOVERAGE_APPBASE_PATH));
$excludePaths = array(realpath($PHPCOVERAGE_APPBASE_PATH)."/lang", realpath($PHPCOVERAGE_APPBASE_PATH)."/libraries/adodb/drivers");
$cov = new RemoteCoverageRecorder($includePaths, $excludePaths, $reporter);
    
// Generate the code coverage report
$cov->generateReport($xml);

$reporter->printTextSummary();

?>