In your .travis.yml file, add:
before_install: - composer require phpunit/phpunit:4.8.* satooshi/php-coveralls:dev-master - composer install --dev script: - ./vendor/bin/phpunit --coverage-clover ./tests/logs/clover.xml after_script: - php vendor/bin/coveralls -v
before_install: Calls composer and installs PHPUnit 4.8.* + satooshi/php-coveralls.
script: Calls the installed version of PHPUnit and generates a clover.xml file in
./tests/logs/clover.xml. (This XML file will be used by PHP-Coveralls.)
after_script: Launches satooshi/php-coveralls in verbose mode.
Create a .coveralls.yml file that looks like:
coverage_clover: tests/logs/clover.xml json_path: tests/logs/coveralls-upload.json service_name: travis-ci
coverage_clover: Is the path to the PHPUnit generated
json_path: Is where to output a
json_filethat will be uploaded to the Coveralls API.
service_name: Use either
Add badges to your GitHub README.md file.
[![Build Status](https://travis-ci.org/NAMESPACE/REPO.svg?branch=master)](https://travis-ci.org/NAMESPACE/REPO) [![Coverage Status](https://coveralls.io/repos/NAMESPACE/REPO/badge.svg?branch=master&service=github)](https://coveralls.io/github/NAMESPACE/REPO?branch=master)
REPO to match your GitHub repo.