-
Notifications
You must be signed in to change notification settings - Fork 0
/
.atoum.php
51 lines (44 loc) · 1.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
<?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
atoum\atoum,
atoum\atoum\reports,
atoum\atoum\writers\std
;
// use mageekguy\atoum\reports;
$runner
->addTestsFromDirectory(__DIR__ . '/tests/units/')
->disallowUsageOfUndefinedMethodInMock();
$runner->getScore()->getCoverage();
$CI = getenv('coverage');
if ($CI)
{
echo "CI: $CI\n";
$script->addDefaultReport();
$coverallsToken = getenv('COVERALLS_REPO_TOKEN') ?: null;
echo "Len token : " . strlen($coverallsToken) . "\n";
$coverallsReport = new reports\asynchronous\coveralls('classes', $coverallsToken);
$defaultFinder = $coverallsReport->getBranchFinder();
$coverallsReport
->setBranchFinder(function() use ($defaultFinder) {
if (($branch = getenv('GITHUB_BRANCH')) === false)
{
$branch = $defaultFinder();
}
return $branch;
}
)
->setServiceName('github-actions')
->setServiceJobId(getenv('GITHUB_RUN_NUMBER') ?: null)
->addDefaultWriter()
;
$runner->addReport($coverallsReport);
} else {
echo "No coverage reports (missing coverage env variable) : $CI\n";
}