Issues (5)

.atoum.php (1 issue)

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
$script->getRunner()->addTestsFromDirectory(__DIR__.'/test/unit/src');
18
19
if(file_exists('/home/travis'))
20
{
21
    /*
22
    Publish code coverage report on coveralls.io
23
    */
24
    $sources = './src';
25
    $token = 'SoXzLQVMf3fSHaiEANaQhclas6bsWZjHA';
26
    $coverallsReport = new reports\asynchronous\coveralls($sources, $token);
27
    
28
    /*
29
    If you are using Travis-CI (or any other CI tool), you should customize the report
30
    * https://coveralls.io/docs/api
31
    * http://about.travis-ci.org/docs/user/ci-environment/#Environment-variables
32
    * https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables
33
    */
34
    $defaultFinder = $coverallsReport->getBranchFinder();
35
    $coverallsReport
36
        ->setBranchFinder(function() use ($defaultFinder) {
0 ignored issues
show
function(...) { /* ... */ } of type callable is incompatible with the type null|closure expected by parameter $finder of mageekguy\atoum\reports\...alls::setBranchFinder(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

36
        ->setBranchFinder(/** @scrutinizer ignore-type */ function() use ($defaultFinder) {
Loading history...
37
            if (($branch = getenv('TRAVIS_BRANCH')) === false)
38
            {
39
                $branch = $defaultFinder();
40
            }
41
    
42
            return $branch;
43
        })
44
        ->setServiceName(getenv('TRAVIS') ? 'travis-ci' : null)
45
        ->setServiceJobId(getenv('TRAVIS_JOB_ID') ?: null)
46
        ->addDefaultWriter()
47
    ;
48
    
49
    $runner->addReport($coverallsReport);
50
    
51
    //Scrutinizer coverage
52
	$cloverWriter = new atoum\writers\file('clover.xml');
53
	$cloverReport = new atoum\reports\asynchronous\clover();
54
	$cloverReport->addWriter($cloverWriter);
55
56
	$runner->addReport($cloverReport);
57
}
58