1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
This file will automatically be included before EACH run. |
5
|
|
|
|
6
|
|
|
Use it to configure atoum or anything that needs to be done before EACH run. |
7
|
|
|
|
8
|
|
|
More information on documentation: |
9
|
|
|
[en] http://docs.atoum.org/en/chapter3.html#Configuration-files |
10
|
|
|
[fr] http://docs.atoum.org/fr/chapter3.html#Fichier-de-configuration |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
use \mageekguy\atoum; |
14
|
|
|
//use \mageekguy\atoum\reports; |
15
|
|
|
|
16
|
|
|
// CODE COVERAGE SETUP |
17
|
|
|
if(!file_exists('/home/travis')) |
18
|
|
|
{ |
19
|
|
|
$report = $script->addDefaultReport(); |
20
|
|
|
|
21
|
|
|
$coverageField = new atoum\report\fields\runner\coverage\html('BFW', '/home/bfw-website/www_reports/bfw-cli/test-unit'); |
22
|
|
|
$coverageField->setRootUrl('http://bfw.bulton.fr/reports/bfw-cli/test-unit/index.html'); |
23
|
|
|
$report->addField($coverageField); |
24
|
|
|
|
25
|
|
|
$treemapField = new atoum\report\fields\runner\coverage\treemap('BFW', '/home/bfw-website/www_reports/bfw-cli/treemap'); |
26
|
|
|
$treemapField->setHtmlReportBaseUrl('http://bfw.bulton.fr/reports/bfw-cli/treemap/index.html'); |
27
|
|
|
$report->addField($treemapField); |
28
|
|
|
} |
29
|
|
|
/**/ |
30
|
|
|
|
31
|
|
|
if(file_exists('/home/travis')) |
32
|
|
|
{ |
33
|
|
|
$script->addDefaultReport(); //For travis debug only ! |
34
|
|
|
|
35
|
|
|
//* Publish code coverage report on coveralls.io |
36
|
|
|
$sources = './src'; |
37
|
|
|
$token = 'EX10JkBefBFNC7Lu9yeSWBSC98Ekm6K4V'; |
38
|
|
|
$coverallsReport = new atoum\reports\asynchronous\coveralls($sources, $token); |
39
|
|
|
|
40
|
|
|
// If you are using Travis-CI (or any other CI tool), you should customize the report |
41
|
|
|
// https://coveralls.io/docs/api |
42
|
|
|
// http://about.travis-ci.org/docs/user/ci-environment/#Environment-variables |
43
|
|
|
// https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables |
44
|
|
|
$defaultFinder = $coverallsReport->getBranchFinder(); |
45
|
|
|
$coverallsReport |
46
|
|
|
->setBranchFinder(function() use ($defaultFinder) { |
|
|
|
|
47
|
|
|
if (($branch = getenv('TRAVIS_BRANCH')) === false) |
48
|
|
|
{ |
49
|
|
|
$branch = $defaultFinder(); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
return $branch; |
53
|
|
|
}) |
54
|
|
|
->setServiceName(getenv('TRAVIS') ? 'travis-ci' : null) |
55
|
|
|
->setServiceJobId(getenv('TRAVIS_JOB_ID') ?: null) |
56
|
|
|
->addDefaultWriter() |
57
|
|
|
; |
58
|
|
|
|
59
|
|
|
$runner->addReport($coverallsReport); |
60
|
|
|
|
61
|
|
|
//Scrutinizer coverage |
62
|
|
|
$cloverWriter = new atoum\writers\file('clover.xml'); |
63
|
|
|
$cloverReport = new atoum\reports\asynchronous\clover(); |
64
|
|
|
$cloverReport->addWriter($cloverWriter); |
65
|
|
|
|
66
|
|
|
$runner->addReport($cloverReport); |
67
|
|
|
} |
68
|
|
|
|