Skip to content

Commit

Permalink
Add phpunit coverage filter
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsternberg committed May 21, 2018
1 parent 6a9c776 commit 5734793
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ cache:
- $HOME/.phpbrew

before_script: # Make PHP 7 test work. https://github.com/CMB2/CMB2/pull/885
- echo "WP_VERSION = $WP_VERSION"
- echo "CC_TEST_REPORTER_ID = $CC_TEST_REPORTER_ID"
- echo "GIT_COMMITTED_AT = $GIT_COMMITTED_AT"
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- |
if [[ ! -z "$WP_VERSION" ]] ; then
Expand All @@ -67,11 +64,11 @@ before_script: # Make PHP 7 test work. https://github.com/CMB2/CMB2/pull/885
./cc-test-reporter before-build
fi
script: if [[ latest == $WP_VERSION ]]; then phpunit --coverage-clover=build/logs/clover.xml; else phpunit --exclude-group cmb2-rest-api --coverage-clover=build/logs/clover.xml; fi
script: if [[ latest == $WP_VERSION ]]; then phpunit --coverage-clover=clover.xml; else phpunit --exclude-group cmb2-rest-api --coverage-clover=clover.xml; fi

after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
- php ocular.phar code-coverage:upload --format=php-clover clover.xml
- |
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
if [[ ! -z "$CC_TEST_REPORTER_ID" ]] ; then
Expand Down
11 changes: 10 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,13 @@
<directory prefix="test-" suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory>includes</directory>
<file>init.php</file>
<exclude>
<directory suffix=".php">includes/shim</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

0 comments on commit 5734793

Please sign in to comment.