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
|
|
|
\mageekguy\atoum\reports; |
15
|
|
|
|
16
|
|
|
$report = $script->addDefaultReport(); |
17
|
|
|
|
18
|
|
|
/* |
19
|
|
|
LOGO |
20
|
|
|
*/ |
21
|
|
|
// This will add the atoum logo before each run. |
22
|
|
|
$report->addField(new atoum\report\fields\runner\atoum\logo()); |
23
|
|
|
|
24
|
|
|
// This will add a green or red logo after each run depending on its status. |
25
|
|
|
$report->addField(new atoum\report\fields\runner\result\logo()); |
26
|
|
|
/**/ |
27
|
|
|
|
28
|
|
|
$script->getRunner()->addTestsFromDirectory(__DIR__ . '/test/unit/src'); |
29
|
|
|
|
30
|
|
|
if(file_exists('/home/travis')) |
31
|
|
|
{ |
32
|
|
|
/* |
33
|
|
|
Publish code coverage report on coveralls.io |
34
|
|
|
*/ |
35
|
|
|
$sources = './src'; |
36
|
|
|
$token = 'SoXzLQVMf3fSHaiEANaQhclas6bsWZjHA'; |
37
|
|
|
$coverallsReport = new reports\asynchronous\coveralls($sources, $token); |
38
|
|
|
|
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
|
|
|
*/ |
45
|
|
|
$defaultFinder = $coverallsReport->getBranchFinder(); |
46
|
|
|
$coverallsReport |
47
|
|
|
->setBranchFinder(function() use ($defaultFinder) { |
|
|
|
|
48
|
|
|
if (($branch = getenv('TRAVIS_BRANCH')) === false) |
49
|
|
|
{ |
50
|
|
|
$branch = $defaultFinder(); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
return $branch; |
54
|
|
|
}) |
55
|
|
|
->setServiceName(getenv('TRAVIS') ? 'travis-ci' : null) |
56
|
|
|
->setServiceJobId(getenv('TRAVIS_JOB_ID') ?: null) |
57
|
|
|
->addDefaultWriter() |
58
|
|
|
; |
59
|
|
|
|
60
|
|
|
$runner->addReport($coverallsReport); |
61
|
|
|
|
62
|
|
|
//Scrutinizer coverage |
63
|
|
|
$cloverWriter = new atoum\writers\file('clover.xml'); |
64
|
|
|
$cloverReport = new atoum\reports\asynchronous\clover(); |
65
|
|
|
$cloverReport->addWriter($cloverWriter); |
66
|
|
|
|
67
|
|
|
$runner->addReport($cloverReport); |
68
|
|
|
} |
69
|
|
|
|