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 Api', '/home/bfw-website/www_reports/bfw-api-v2/test-unit'); |
22
|
|
|
$coverageField->setRootUrl('http://bfw.bulton.fr/reports/bfw-api-v2/test-unit/index.html'); |
23
|
|
|
$report->addField($coverageField); |
24
|
|
|
|
25
|
|
|
$treemapField = new atoum\report\fields\runner\coverage\treemap('BFW Api', '/home/bfw-website/www_reports/bfw-api-v2/treemap'); |
26
|
|
|
$treemapField->setHtmlReportBaseUrl('http://bfw.bulton.fr/reports/bfw-api-v2/treemap/index.html'); |
27
|
|
|
$report->addField($treemapField); |
28
|
|
|
} |
29
|
|
|
/**/ |
30
|
|
|
|
31
|
|
|
/* |
32
|
|
|
TEST GENERATOR SETUP |
33
|
|
|
*//* |
34
|
|
|
$script->getRunner()->addTestsFromDirectory(__DIR__.'/test/unit/install/class'); |
35
|
|
|
$script->getRunner()->addTestsFromDirectory(__DIR__.'/test/unit/src/class'); |
36
|
|
|
$script->getRunner()->addTestsFromDirectory(__DIR__.'/test/unit/src/class/core'); |
37
|
|
|
$script->getRunner()->addTestsFromDirectory(__DIR__.'/test/unit/src/class/memcache'); |
38
|
|
|
//$script->getRunner()->addTestsFromDirectory(__DIR__.'/test/unit/src/functions'); |
39
|
|
|
//$script->getRunner()->addTestsFromDirectory(__DIR__.'/test/unit/src/trait'); |
40
|
|
|
/**/ |
41
|
|
|
|
42
|
|
|
if(file_exists('/home/travis')) |
43
|
|
|
{ |
44
|
|
|
$script->addDefaultReport(); |
45
|
|
|
|
46
|
|
|
// Publish code coverage report on coveralls.io |
47
|
|
|
$sources = './src'; |
48
|
|
|
$token = 'mXdmDIuMOxEiW3TxPkKQwG2HzEaIKxbbj'; |
49
|
|
|
$coverallsReport = new atoum\reports\asynchronous\coveralls($sources, $token); |
50
|
|
|
|
51
|
|
|
// If you are using Travis-CI (or any other CI tool), you should customize the report |
52
|
|
|
// https://coveralls.io/docs/api |
53
|
|
|
// http://about.travis-ci.org/docs/user/ci-environment/#Environment-variables |
54
|
|
|
// https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables |
55
|
|
|
$defaultFinder = $coverallsReport->getBranchFinder(); |
56
|
|
|
$coverallsReport |
57
|
|
|
->setBranchFinder(function() use ($defaultFinder) { |
|
|
|
|
58
|
|
|
if (($branch = getenv('TRAVIS_BRANCH')) === false) |
59
|
|
|
{ |
60
|
|
|
$branch = $defaultFinder(); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
return $branch; |
64
|
|
|
}) |
65
|
|
|
->setServiceName(getenv('TRAVIS') ? 'travis-ci' : null) |
66
|
|
|
->setServiceJobId(getenv('TRAVIS_JOB_ID') ?: null) |
67
|
|
|
->addDefaultWriter() |
68
|
|
|
; |
69
|
|
|
|
70
|
|
|
$runner->addReport($coverallsReport); |
71
|
|
|
|
72
|
|
|
//Scrutinizer coverage |
73
|
|
|
$cloverWriter = new atoum\writers\file('clover.xml'); |
74
|
|
|
$cloverReport = new atoum\reports\asynchronous\clover(); |
75
|
|
|
$cloverReport->addWriter($cloverWriter); |
76
|
|
|
|
77
|
|
|
$runner->addReport($cloverReport); |
78
|
|
|
} |
79
|
|
|
|