Skip to content

captn3m0/php-codacy-coverage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codacy PHP Coverage Reporter

Codacy coverage support for PHP. Get coverage reporting and code analysis for PHP from Codacy.

Codacy Badge

Prerequisites

  • PHP 5.3 or later
  • One of the following coverage report formats
    • Clover XML (e.g. --coverage-clover in PHPUnit)
    • PHPUnit XML (e.g. --coverage-xml in PHPUnit)

Installation

Setup codacy-coverage with Composer, just add the following to your composer.json:

// composer.json
{
    "require-dev": {
        "codacy/coverage": "dev-master"
    }
}

Download the dependencies by running Composer in the directory of your composer.json:

# install
$ php composer.phar install --dev
# update
$ php composer.phar update codacy/coverage --dev

codacy-coverage library is available on Packagist.

Add the autoloader to your php script:

require_once 'vendor/autoload.php';

Usage

Run vendor/bin/codacycoverage to see a list of commands.

Basic usage for Clover format:

vendor/bin/codacycoverage clover

Basic usage for PHPUnit XML format:

php vendor/bin/codacycoverage phpunit

By default we assume that

  • your Clover coverage report is saved in build/logs/clover.xml
  • your PHPUnit XML report is saved in the directory build/coverage-xml

Optional parameters:

You can specify the path to your report with the second parameter:

  • Clover XML
    • php vendor/bin/codacycoverage clover path/to/a-clover.xml
  • PHPUnit XML
    • php vendor/bin/codacycoverage phpunit directory/path/to/phpunitreport

Even more control:

  • --base-url=<OTHER_URL> defaults to http://codacy.com
  • --git-commit=<COMMIT_HASH> defaults to the last commit hash

Travis CI

Add codacycoverage to your .travis.yml:

# .travis.yml
language: php
php:
  - 5.3
  - 5.4
  - 5.5
  - 5.6
  - hhvm

before_script:
  - curl -s http://getcomposer.org/installer | php
  - php composer.phar install -n

script:
  - php vendor/bin/phpunit

after_script:
  - php vendor/bin/codacycoverage clover path/to/clover.xml

License

MIT

About

Phar for uploading Scala code coverage to Codacy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%