-
Notifications
You must be signed in to change notification settings - Fork 1
/
.atoum.php
105 lines (81 loc) · 3.46 KB
/
.atoum.php
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/*
This file will automatically be included before EACH run.
Use it to configure atoum or anything that needs to be done before EACH run.
More information on documentation:
[en] http://docs.atoum.org/en/chapter3.html#Configuration-files
[fr] http://docs.atoum.org/fr/chapter3.html#Fichier-de-configuration
*/
use \mageekguy\atoum,
\mageekguy\atoum\reports;
$report = $script->addDefaultReport();
/*
LOGO
*/
// This will add the atoum logo before each run.
$report->addField(new atoum\report\fields\runner\atoum\logo());
// This will add a green or red logo after each run depending on its status.
$report->addField(new atoum\report\fields\runner\result\logo());
/**/
/*
CODE COVERAGE SETUP
*/
if(!file_exists('/home/travis'))
{
// Please replace in next line "Project Name" by your project name and "/path/to/destination/directory" by your destination directory path for html files.
$coverageField = new atoum\report\fields\runner\coverage\html('BFW', '/home/bfw/www/reports/bfw-v2');
// Please replace in next line http://url/of/web/site by the root url of your code coverage web site.
$coverageField->setRootUrl('http://bfw.test.bulton.fr/reports/bfw-v2/');
$report->addField($coverageField);
}
/**/
/*
TEST GENERATOR SETUP
*/
$testGenerator = new atoum\test\generator();
// Please replace in next line "/path/to/your/tests/units/classes/directory" by your unit test's directory.
$testGenerator->setTestClassesDirectory(__DIR__.'/test/classes');
// Please replace in next line "your\project\namespace\tests\units" by your unit test's namespace.
$testGenerator->setTestClassNamespace('BFW\test\unit');
// Please replace in next line "/path/to/your/classes/directory" by your classes directory.
$testGenerator->setTestedClassesDirectory(__DIR__.'/src/classes');
// Please replace in next line "your\project\namespace" by your project namespace.
$testGenerator->setTestedClassNamespace('BFW');
// Please replace in next line "path/to/your/tests/units/runner.php" by path to your unit test's runner.
//$testGenerator->setRunnerPath('path/to/your/tests/units/runner.php');
$script->getRunner()->setTestGenerator($testGenerator);
/**/
if(file_exists('/home/travis'))
{
/*
Publish code coverage report on coveralls.io
*/
$sources = './src';
$token = 'ycIQWlEx47Xh3QzvlQ4kxh3jOHHo55m1E';
$coverallsReport = new reports\asynchronous\coveralls($sources, $token);
/*
If you are using Travis-CI (or any other CI tool), you should customize the report
* https://coveralls.io/docs/api
* http://about.travis-ci.org/docs/user/ci-environment/#Environment-variables
* https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables
*/
$defaultFinder = $coverallsReport->getBranchFinder();
$coverallsReport
->setBranchFinder(function() use ($defaultFinder) {
if (($branch = getenv('TRAVIS_BRANCH')) === false)
{
$branch = $defaultFinder();
}
return $branch;
})
->setServiceName(getenv('TRAVIS') ? 'travis-ci' : null)
->setServiceJobId(getenv('TRAVIS_JOB_ID') ?: null)
->addDefaultWriter()
;
$runner->addReport($coverallsReport);
//Scrutinizer coverage
$cloverWriter = new atoum\writers\file('clover.xml');
$cloverReport = new atoum\reports\asynchronous\clover();
$cloverReport->addWriter($cloverWriter);
$runner->addReport($cloverReport);
}