bulton-fr /
call-curl
| 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/class'); |
||
| 29 | $script->getRunner()->addTestsFromDirectory(__DIR__ . '/test/parser'); |
||
| 30 | |||
| 31 | if(file_exists('/home/travis')) |
||
| 32 | { |
||
| 33 | /* |
||
| 34 | Publish code coverage report on coveralls.io |
||
| 35 | */ |
||
| 36 | $sources = './src'; |
||
| 37 | $token = 'CYDuDqxFSzlQ5v9axpNt40eTsmAciUFdm'; |
||
| 38 | $coverallsReport = new reports\asynchronous\coveralls($sources, $token); |
||
| 39 | |||
| 40 | /* |
||
| 41 | If you are using Travis-CI (or any other CI tool), you should customize the report |
||
| 42 | * https://coveralls.io/docs/api |
||
| 43 | * http://about.travis-ci.org/docs/user/ci-environment/#Environment-variables |
||
| 44 | * https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables |
||
| 45 | */ |
||
| 46 | $defaultFinder = $coverallsReport->getBranchFinder(); |
||
| 47 | $coverallsReport |
||
| 48 | ->setBranchFinder(function() use ($defaultFinder) { |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 49 | if (($branch = getenv('TRAVIS_BRANCH')) === false) |
||
| 50 | { |
||
| 51 | $branch = $defaultFinder(); |
||
| 52 | } |
||
| 53 | |||
| 54 | return $branch; |
||
| 55 | }) |
||
| 56 | ->setServiceName(getenv('TRAVIS') ? 'travis-ci' : null) |
||
| 57 | ->setServiceJobId(getenv('TRAVIS_JOB_ID') ?: null) |
||
| 58 | ->addDefaultWriter() |
||
| 59 | ; |
||
| 60 | |||
| 61 | $runner->addReport($coverallsReport); |
||
| 62 | |||
| 63 | //Scrutinizer coverage |
||
| 64 | $cloverWriter = new atoum\writers\file('clover.xml'); |
||
| 65 | $cloverReport = new atoum\reports\asynchronous\clover(); |
||
| 66 | $cloverReport->addWriter($cloverWriter); |
||
| 67 | |||
| 68 | $runner->addReport($cloverReport); |
||
| 69 | } |
||
| 70 |