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 | /* Atoum Logo (add slash to start of this line for enable/disable) |
||
20 | $report = $script->addDefaultReport(); |
||
21 | $report->addField(new atoum\report\fields\runner\atoum\logo()); //Start |
||
22 | $report->addField(new atoum\report\fields\runner\result\logo()); //End status |
||
23 | /*/ |
||
24 | //Nyancat |
||
25 | $stdout = new \mageekguy\atoum\writers\std\out; |
||
26 | $report = new \mageekguy\atoum\reports\realtime\nyancat; |
||
27 | $script->addReport($report->addWriter($stdout)); |
||
28 | /**/ |
||
29 | |||
30 | $coverageField = new atoum\report\fields\runner\coverage\html('BFW Api', '/home/bfw/www/reports/php-to-xml'); |
||
31 | $coverageField->setRootUrl('http://bfw.test.bulton.fr/reports/php-to-xml/'); |
||
32 | $report->addField($coverageField); |
||
33 | |||
34 | $treemapField = new atoum\report\fields\runner\coverage\treemap('BFW Api', '/home/bfw/www/treemap/php-to-xml'); |
||
35 | $treemapField->setHtmlReportBaseUrl('http://bfw.test.bulton.fr/treemap/php-to-xml/'); |
||
36 | $report->addField($treemapField); |
||
37 | } |
||
38 | /**/ |
||
39 | |||
40 | /* |
||
41 | TEST GENERATOR SETUP |
||
42 | *//* |
||
43 | $script->getRunner()->addTestsFromDirectory(__DIR__.'/test/unit/install/class'); |
||
44 | $script->getRunner()->addTestsFromDirectory(__DIR__.'/test/unit/src/class'); |
||
45 | $script->getRunner()->addTestsFromDirectory(__DIR__.'/test/unit/src/class/core'); |
||
46 | $script->getRunner()->addTestsFromDirectory(__DIR__.'/test/unit/src/class/memcache'); |
||
47 | //$script->getRunner()->addTestsFromDirectory(__DIR__.'/test/unit/src/functions'); |
||
48 | //$script->getRunner()->addTestsFromDirectory(__DIR__.'/test/unit/src/trait'); |
||
49 | /**/ |
||
50 | |||
51 | if(file_exists('/home/travis')) |
||
52 | { |
||
53 | // Publish code coverage report on coveralls.io |
||
54 | $sources = './src'; |
||
55 | $token = 'd0ZRbZgQ9zac7AB7it6WDTcTLmXghDGLB'; |
||
56 | $coverallsReport = new atoum\reports\asynchronous\coveralls($sources, $token); |
||
57 | |||
58 | // If you are using Travis-CI (or any other CI tool), you should customize the report |
||
59 | // https://coveralls.io/docs/api |
||
60 | // http://about.travis-ci.org/docs/user/ci-environment/#Environment-variables |
||
61 | // https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables |
||
62 | $defaultFinder = $coverallsReport->getBranchFinder(); |
||
63 | $coverallsReport |
||
64 | ->setBranchFinder(function() use ($defaultFinder) { |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
65 | if (($branch = getenv('TRAVIS_BRANCH')) === false) |
||
66 | { |
||
67 | $branch = $defaultFinder(); |
||
68 | } |
||
69 | |||
70 | return $branch; |
||
71 | }) |
||
72 | ->setServiceName(getenv('TRAVIS') ? 'travis-ci' : null) |
||
73 | ->setServiceJobId(getenv('TRAVIS_JOB_ID') ?: null) |
||
74 | ->addDefaultWriter() |
||
75 | ; |
||
76 | |||
77 | $runner->addReport($coverallsReport); |
||
78 | |||
79 | //Scrutinizer coverage |
||
80 | $cloverWriter = new atoum\writers\file('clover.xml'); |
||
81 | $cloverReport = new atoum\reports\asynchronous\clover(); |
||
82 | $cloverReport->addWriter($cloverWriter); |
||
83 | |||
84 | $runner->addReport($cloverReport); |
||
85 | } |
||
86 |