Skip to content

Commit a568a78

Browse files
committed
Enable code coverage for the library
- added coveralls configuration - coverage badge in README - added composer scripts - updated travis configuration - phpunit.xml changed to .dist - updated .gitignore
1 parent 68303cc commit a568a78

File tree

7 files changed

+35
-11
lines changed

7 files changed

+35
-11
lines changed

.coveralls.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
coverage_clover: clover.xml
2+
json_path: coveralls-upload.json

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
vendor/
2+
phpunit.xml
3+
clover.xml
4+
coveralls-upload.json

.travis.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ env:
1212
- COMPOSER_ARGS="--no-interaction --ignore-platform-reqs"
1313

1414
matrix:
15-
fast_finish: true
1615
include:
1716
- php: 5.6
1817
env:
1918
- DEPS=lowest
2019
- php: 5.6
2120
env:
2221
- DEPS=locked
22+
- TEST_COVERAGE=true
2323
- php: 5.6
2424
env:
2525
- DEPS=latest
@@ -33,18 +33,27 @@ matrix:
3333
- php: 7
3434
env:
3535
- DEPS=latest
36-
- php: hhvm
36+
- php: 7.1
3737
env:
3838
- DEPS=lowest
39-
- php: hhvm
39+
- php: 7.1
4040
env:
4141
- DEPS=locked
42-
- php: hhvm
42+
- php: 7.1
43+
env:
44+
- DEPS=latest
45+
- php: hhvm
46+
env:
47+
- DEPS=lowest
48+
- php: hhvm
49+
env:
50+
- DEPS=locked
51+
- php: hhvm
4352
env:
4453
- DEPS=latest
4554
allow_failures:
4655
- php: hhvm
47-
56+
4857
notifications:
4958
irc: "irc.freenode.org#apigility-dev"
5059
email: false
@@ -54,11 +63,15 @@ before_install:
5463
- travis_retry composer self-update
5564

5665
install:
66+
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi
5767
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
5868
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
5969
- travis_retry composer install $COMPOSER_ARGS
6070
- composer show
6171

6272
script:
63-
- composer test
73+
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
6474
- if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi
75+
76+
after_script:
77+
- if [[ $TEST_COVERAGE == 'true' ]]; then composer upload-coverage ; fi

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ ZF Api Problem
22
==============
33

44
[![Build Status](https://travis-ci.org/zfcampus/zf-api-problem.png)](https://travis-ci.org/zfcampus/zf-api-problem)
5+
[![Coverage Status](https://coveralls.io/repos/github/zfcampus/zf-api-problem/badge.svg)](https://coveralls.io/github/zfcampus/zf-api-problem)
56

67
Introduction
78
------------

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@
5454
"@cs-check",
5555
"@test"
5656
],
57+
"upload-coverage": "coveralls -v",
5758
"cs-check": "phpcs",
5859
"cs-fix": "phpcbf",
59-
"test": "phpunit"
60+
"test": "phpunit",
61+
"test-coverage": "phpunit --coverage-clover clover.xml"
6062
}
6163
}

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<phpunit bootstrap="./vendor/autoload.php" colors="true">
23
<testsuites>
34
<testsuite name="ZFApiProblem Module Tests">
45
<directory>./test</directory>
56
</testsuite>
6-
<testsuite name="ZFApiProblem Module Class tests">
7-
<file>./ModuleTest.php</file>
8-
</testsuite>
97
</testsuites>
8+
<filter>
9+
<whitelist addUncoveredFilesFromWhitelist="true">
10+
<directory>./src</directory>
11+
</whitelist>
12+
</filter>
1013
</phpunit>

0 commit comments

Comments
 (0)