|
9 | 9 | [fr] http://docs.atoum.org/fr/chapter3.html#Fichier-de-configuration
|
10 | 10 | */
|
11 | 11 |
|
12 |
| -$report = $script->addDefaultReport(); |
13 |
| - |
14 |
| -/* |
15 |
| -LOGO |
16 |
| -*/ |
17 |
| -// This will add the atoum logo before each run. |
18 |
| -// $report->addField(new atoum\report\fields\runner\atoum\logo()); |
19 |
| - |
20 |
| -// This will add a green or red logo after each run depending on its status. |
21 |
| -// $report->addField(new atoum\report\fields\runner\result\logo()); |
22 |
| - |
23 |
| -/* |
24 |
| -CODE COVERAGE SETUP |
25 |
| -*/ |
26 |
| -// Please replace in next line "Project Name" by your project name and "/path/to/destination/directory" by your destination directory path for html files. |
27 |
| -$coverage_field = new atoum\report\fields\runner\coverage\html('php-pwned-passwords', __DIR__.'/reports/atoum'); |
28 |
| - |
29 |
| -// Please replace in next line http://url/of/web/site by the root url of your code coverage web site. |
30 |
| -// $coverage_field->setRootUrl('http://url/of/web/site'); |
31 |
| - |
32 |
| -$report->addField($coverage_field); |
33 |
| - |
34 |
| -/* |
35 |
| -TEST GENERATOR SETUP |
36 |
| -*/ |
37 |
| -$test_generator = new atoum\test\generator(); |
38 |
| - |
39 |
| -// Please replace in next line "/path/to/your/tests/units/classes/directory" by your unit test's directory. |
40 |
| -$test_generator->setTestClassesDirectory(__DIR__.'/tests/units/'); |
41 |
| - |
42 |
| -// Please replace in next line "your\project\namespace\tests\units" by your unit test's namespace. |
43 |
| -$test_generator->setTestClassNamespace('UniversiteRennes2\PwnedPasswords\tests\units'); |
44 |
| - |
45 |
| -// Please replace in next line "/path/to/your/classes/directory" by your classes directory. |
46 |
| -$test_generator->setTestedClassesDirectory(__DIR__.'/src/PwnedPasswords.php'); |
47 |
| - |
48 |
| -// Please replace in next line "your\project\namespace" by your project namespace. |
49 |
| -$test_generator->setTestedClassNamespace('UniversiteRennes2\PwnedPasswords'); |
50 |
| - |
51 |
| -// Please replace in next line "path/to/your/tests/units/runner.php" by path to your unit test's runner. |
52 |
| -// $test_generator->setRunnerPath('path/to/your/tests/units/runner.php'); |
53 |
| - |
54 |
| -$script->getRunner()->setTestGenerator($test_generator); |
55 |
| - |
| 12 | +use mageekguy\atoum\reports; |
| 13 | + |
| 14 | +$runner |
| 15 | + ->addTestsFromDirectory(__DIR__ . '/tests/units/') |
| 16 | + ->disallowUsageOfUndefinedMethodInMock(); |
| 17 | + |
| 18 | +$runner->getScore()->getCoverage(); |
| 19 | + |
| 20 | +$travis = getenv('TRAVIS'); |
| 21 | +if ($travis) |
| 22 | +{ |
| 23 | + $script->addDefaultReport(); |
| 24 | + $coverallsToken = getenv('COVERALLS_REPO_TOKEN'); |
| 25 | + if ($coverallsToken) |
| 26 | + { |
| 27 | + $coverallsReport = new reports\asynchronous\coveralls('classes', $coverallsToken); |
| 28 | + $defaultFinder = $coverallsReport->getBranchFinder(); |
| 29 | + $coverallsReport |
| 30 | + ->setBranchFinder(function() use ($defaultFinder) { |
| 31 | + if (($branch = getenv('TRAVIS_BRANCH')) === false) |
| 32 | + { |
| 33 | + $branch = $defaultFinder(); |
| 34 | + } |
| 35 | + return $branch; |
| 36 | + } |
| 37 | + ) |
| 38 | + ->setServiceName(getenv('TRAVIS') ? 'travis-ci' : null) |
| 39 | + ->setServiceJobId(getenv('TRAVIS_JOB_ID') ?: null) |
| 40 | + ->addDefaultWriter() |
| 41 | + ; |
| 42 | + $runner->addReport($coverallsReport); |
| 43 | + $script->testIt(); |
| 44 | + } |
| 45 | +} |
0 commit comments