Code Monkey home page Code Monkey logo

php-test-reporter's Introduction

Build Status Code Climate Test Coverage

codeclimate-test-reporter - [DEPRECATED]

These configuration instructions refer to a language-specific test reporter which is now deprecated in favor of our new unified test reporter client. The new test reporter is faster, distributed as a static binary, has support for parallelized CI builds, and will receive ongoing support by the team here. The existing test reporters for Ruby, Python, PHP, and Javascript are now deprecated.

Collects test coverage data from your PHP test suite and sends it to Code Climate's hosted, automated code review service.

Code Climate - https://codeclimate.com

Important: If you encounter an error involving SSL certificates, see the Known Issue: SSL Certificate Error section below.

Important FYIs

Across the many different testing frameworks, setups, and environments, there are lots of variables at play. Before setting up test coverage, it's important to understand what we do and do not currently support:

  • Single payload: We currently only support a single test coverage payload per commit. If you run your tests in multiple steps, or via parallel tests, Code Climate will only process the first payload that we receive. If you are using a CI, be sure to check if you are running your tests in a parallel mode.

    Note: There is one exception to this rule. We've specifically built an integration with Solano Labs to support parallel tests.

    Note: If you've configured Code Climate to analyze multiple languages in the same repository (e.g., Ruby and JavaScript), we can nonetheless only process test coverage information for one of these languages. We'll process the first payload that we receive.

  • Invalid File Paths: By default, our test reporters expect your application to exist at the root of your repository. If this is not the case, the file paths in your test coverage payload will not match the file paths that Code Climate expects.

Requirements

There are several requirements you'll need in order to use the PHP test reporter on your system:

The test reporter uses the PHPUnit testing tool to generate code coverage information. These results show how much of your application's code is being executed by your unit tests. PHPUnit can't generate this information on its own though - it needs another tool, Xdebug. This is not included as a part of the PHPUnit (or PHP) install by default so you'll need to install it yourself.

Xdebug is installed as an extension to PHP, not a library. You can find more information about installing the tool via PECL on the project website.

If you execute your PHPUnit tests with the --coverage-clover option and receive the message "The Xdebug extension is not loaded. No code coverage will be generated." you will need to visit the Xdebug website and install the extension. If you do not, you'll most likely get an error something like this:

PHP Warning:  simplexml_load_file(): I/O warning : failed to load external entity "[...]/build/logs/clover.xml" in [...]/vendor/satooshi/php-coveralls/src/Contrib/Bundle/CoverallsV1Bundle/Api/Jobs.php on line 52

Installation

This package requires a user, but not necessarily a paid account, on Code Climate, so if you don't have one the first step is to signup at: https://codeclimate.com.

Via composer

To install php-test-reporter with Composer run the following command.

$ composer require codeclimate/php-test-reporter --dev

This will get you the latest version of the reporter and install it. If you do want the master, untagged, version you may use the command below:

$ composer require codeclimate/php-test-reporter:@dev --dev

As PHAR tool

Checkout the latest release here and replace X.X.X with the latest version.

$ RELEASE=X.X.X
$ wget -c "https://github.com/codeclimate/php-test-reporter/releases/download/$RELEASE/codeclimate-test-reporter.phar"

Usage

  • Generate coverage data to build/logs/clover.xml

Add the following to phpunit.xml.dist:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit ...>
  <logging>
    ...
    <log type="coverage-clover" target="build/logs/clover.xml"/>
    ...
  </logging>
</phpunit>

Or invoke phpunit as follows:

$ phpunit --coverage-clover build/logs/clover.xml
  • Specifying your repo token as an environment variable, invoke the test-reporter:
$ CODECLIMATE_REPO_TOKEN="..." vendor/bin/test-reporter

# ... or via PHAR ...

$ CODECLIMATE_REPO_TOKEN="..." codeclimate-test-reporter.phar upload

The CODECLIMATE_REPO_TOKEN value is provided after you add your repo to your Code Climate account by clicking on "Setup Test Coverage" on the right hand side of your feed.

Please contact [email protected] if you need any assistance setting this up.

Troubleshooting

If you're having trouble setting up or working with our test coverage feature, see our detailed help doc, which covers the most common issues encountered.

Known Issue: SSL Certificate Error

If you encounter an error involving SSL certificates when trying to report coverage data from your CI server, you can work around it by manually posting the data via curl:

after_script:
  - CODECLIMATE_REPO_TOKEN="..." bin/test-reporter --stdout > codeclimate.json
  - "curl -X POST -d @codeclimate.json -H 'Content-Type: application/json' -H 'User-Agent: Code Climate (PHP Test Reporter v0.1.1)' https://codeclimate.com/test_reports"

Note: In the command above, you may need to change bin/test-reporter to vendor/bin/test-reporter, depending on your project's directory structure.

More details can be found in this issue.

Contributions

Patches, bug fixes, feature requests, and pull requests are welcome on the GitHub page for this project:

https://github.com/codeclimate/php-test-reporter

This package is maintained by Bryan Helmkamp ([email protected]).

For more details, see CONTRIBUTING.md.

Copyright

See LICENSE.txt

Portions of the implementation were inspired by the php-coveralls project.

php-test-reporter's People

Contributors

1ma avatar aensley avatar davehenton avatar dblandin avatar ericdowell avatar gdiggs avatar hollodotme avatar jacobninja avatar jeffrafter avatar jonathancadepowers avatar jpignata avatar localheinz avatar marshally avatar maxjacobson avatar mimmi20 avatar mrb avatar mrrsm avatar noahd1 avatar pbrisbin avatar rdohms avatar soullivaneuh avatar sun avatar tarlepp avatar tjchambers avatar toolmantim avatar wfleming avatar xzyfer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-test-reporter's Issues

SSL fix makes for an invalid travis file

The following command fails validation when checked with the linter and also seems to stop any builds.

- curl -X POST -d @build/log/codeclimate.json -H 'Content-Type: application/json' -H 'User-Agent: Code Climate (PHP Test Reporter v0.1.1)' https://codeclimate.com/test_reports

screen shot 2014-07-24 at 12 38 02 am

Removing the -H options fixes this but the coverage request doesn't seem to be accepted. Update – this is apparently because the repo could not be found: https://travis-ci.org/sjparkinson/static-review/jobs/30704911#L1283

Composer doesn't install or update properly

I can not get composer to install the php-test-reporter library properly. Our composer.json has this:

"require-dev" : {
"satooshi/php-coveralls" : "dev-master",
"codeclimate/php-test-reporter" : "dev-master"
}

This is the error we always receive:

php composer.phar update

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for codeclimate/php-test-reporter dev-master -> satisfiable by codeclimate/php-test-reporter[dev-master].
- codeclimate/php-test-reporter dev-master requires satooshi/php-coveralls 0.6.* -> no matching package found.

Potential causes:

Read http://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

Semantic versioning and new release

Hi guys,

What do you think about start using semver for that repo? Also, you could create a new release since the latest release is 22 behind the current master. I think that repo is stable enough to bump it to the 1.0.0 version.

Cheers

guzzle/guzzle is abandoned

When installing the package the following message is displayed by composer:

Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.

Would be a good idea to not use abandoned packages

Add exception/failure when HTTP request != 200

When the HTTP request to the server fails for some reason (either the bad cert issue or a 401 like I was seeing in the test reporter), a failure message should be presented to the user.

Class Satooshi\...\Configuration not found in CoverageCollector.php

Heya, I'm trying to setup code coverage on my PHP project and I'm hitting the following error when running ./vendor/bin/test-reporter locally.

Something I'm missing/doing wrong?

PHP Fatal error: 
    Class 'Satooshi\Bundle\CoverallsV1Bundle\Config\Configuration' not found
    in /Users/Samuel/Repositories/Personal/StaticReview/vendor/codeclimate/php-test-reporter/src/CodeClimate/Bundle/TestReporterBundle/CoverageCollector.php
    on line 22

The commands I've run:

composer update --dev --prefer-source --optimize-autoloader

vendor/bin/phpunit --bootstrap vendor/autoload.php --coverage-clover build/logs/clover.xml tests

CODECLIMATE_REPO_TOKEN=[...] ./vendor/bin/test-reporter

Update to README and docs

FYI if you don't use something like export in bash, you're not going to get the CODECLIMATE_REPO_TOKEN to be available inside the PHP script:

export CODECLIMATE_REPO_TOKEN=token-goes-here

If someone copy & pasted from the README and site docs (on the Test Coverage page) they wouldn't get it and the reporter will silently fail with a 401 on the request.

Guzzle SSL Certificate Verification Failure on CircleCI

I'm trying to push coverage results from our CircleCI builds, but the test-reporter step fails at the end with the following error:

[Guzzle\Http\Exception\CurlException]                                        
  [curl] 60: server certificate verification failed. CAfile: /home/ubuntu/Sto  
  ck/www/protected/composer_vendor/guzzle/guzzle/src/Guzzle/Http/Resources/ca  
  cert.pem CRLfile: none [url] https://codeclimate.com/test_reports    

I've tried upgrading to the latest guzzle version in our composer.json, as well as ensuring that the box has running update-ca-certs on the box, but I still get this error. Any ideas?

Support for Symfony 4

Steps required to reproduce the problem

  1. composer create-project "symfony/skeleton:^4.0" symfony4
  2. cd symfony4
  3. composer require codeclimate/php-test-reporter --dev

Expected Result

  • Successfully installation

Actual Result

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - codeclimate/php-test-reporter v0.4.4 requires symfony/console ^2.0 || ^3.0 -> satisfiable by symfony/console[2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.x-dev, 2.1.x-dev, 2.2.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev, 3.1.x-dev, 3.2.x-dev, 3.3.x-dev, 3.4.x-dev, v2.0.10, v2.0.12, v2.0.13, v2.0.14, v2.0.15, v2.0.16, v2.0.17, v2.0.18, v2.0.19, v2.0.20, v2.0.21, v2.0.22, v2.0.23, v2.0.24, v2.0.25, v2.0.9, v2.1.0, v2.1.1, v2.1.10, v2.1.11, v2.1.12, v2.1.13, v2.1.2, v2.1.3, v2.1.4, v2.1.5, v2.1.6, v2.1.7, v2.1.8, v2.1.9, v2.2.0, v2.2.1, v2.2.10, v2.2.11, v2.2.2, v2.2.3, v2.2.4, v2.2.5, v2.2.6, v2.2.7, v2.2.8, v2.2.9, v2.3.0, v2.3.1, v2.3.10, v2.3.11, v2.3.12, v2.3.13, v2.3.14, v2.3.15, v2.3.16, v2.3.17, v2.3.18, v2.3.19, v2.3.2, v2.3.20, v2.3.21, v2.3.22, v2.3.23, v2.3.24, v2.3.25, v2.3.26, v2.3.27, v2.3.28, v2.3.29, v2.3.3, v2.3.30, v2.3.31, v2.3.32, v2.3.33, v2.3.34, v2.3.35, v2.3.36, v2.3.37, v2.3.38, v2.3.39, v2.3.4, v2.3.40, v2.3.41, v2.3.42, v2.3.5, v2.3.6, v2.3.7, v2.3.8, v2.3.9, v2.4.0, v2.4.0-BETA1, v2.4.0-BETA2, v2.4.0-RC1, v2.4.1, v2.4.10, v2.4.2, v2.4.3, v2.4.4, v2.4.5, v2.4.6, v2.4.7, v2.4.8, v2.4.9, v2.5.0, v2.5.0-BETA1, v2.5.0-BETA2, v2.5.0-RC1, v2.5.1, v2.5.10, v2.5.11, v2.5.12, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9, v2.6.0, v2.6.0-BETA1, v2.6.0-BETA2, v2.6.1, v2.6.10, v2.6.11, v2.6.12, v2.6.13, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v2.6.9, v2.7.0, v2.7.0-BETA1, v2.7.0-BETA2, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.18, v2.7.19, v2.7.2, v2.7.20, v2.7.21, v2.7.22, v2.7.23, v2.7.24, v2.7.25, v2.7.26, v2.7.27, v2.7.28, v2.7.29, v2.7.3, v2.7.30, v2.7.31, v2.7.32, v2.7.33, v2.7.34, v2.7.35, v2.7.36, v2.7.37, v2.7.38, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.0-BETA1, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.19, v2.8.2, v2.8.20, v2.8.21, v2.8.22, v2.8.23, v2.8.24, v2.8.25, v2.8.26, v2.8.27, v2.8.28, v2.8.29, v2.8.3, v2.8.30, v2.8.31, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9, v3.0.0, v3.0.0-BETA1, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.0.7, v3.0.8, v3.0.9, v3.1.0, v3.1.0-BETA1, v3.1.0-RC1, v3.1.1, v3.1.10, v3.1.2, v3.1.3, v3.1.4, v3.1.5, v3.1.6, v3.1.7, v3.1.8, v3.1.9, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.10, v3.2.11, v3.2.12, v3.2.13, v3.2.14, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6, v3.2.7, v3.2.8, v3.2.9, v3.3.0, v3.3.0-BETA1, v3.3.0-RC1, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.0-BETA1, v3.4.0-BETA2, v3.4.0-BETA3, v3.4.0-BETA4, v3.4.0-RC1, v3.4.0-RC2] but these conflict with your requirements or minimum-stability.
    - codeclimate/php-test-reporter v0.4.4 requires symfony/console ^2.0 || ^3.0 -> satisfiable by symfony/console[2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.x-dev, 2.1.x-dev, 2.2.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev, 3.1.x-dev, 3.2.x-dev, 3.3.x-dev, 3.4.x-dev, v2.0.10, v2.0.12, v2.0.13, v2.0.14, v2.0.15, v2.0.16, v2.0.17, v2.0.18, v2.0.19, v2.0.20, v2.0.21, v2.0.22, v2.0.23, v2.0.24, v2.0.25, v2.0.9, v2.1.0, v2.1.1, v2.1.10, v2.1.11, v2.1.12, v2.1.13, v2.1.2, v2.1.3, v2.1.4, v2.1.5, v2.1.6, v2.1.7, v2.1.8, v2.1.9, v2.2.0, v2.2.1, v2.2.10, v2.2.11, v2.2.2, v2.2.3, v2.2.4, v2.2.5, v2.2.6, v2.2.7, v2.2.8, v2.2.9, v2.3.0, v2.3.1, v2.3.10, v2.3.11, v2.3.12, v2.3.13, v2.3.14, v2.3.15, v2.3.16, v2.3.17, v2.3.18, v2.3.19, v2.3.2, v2.3.20, v2.3.21, v2.3.22, v2.3.23, v2.3.24, v2.3.25, v2.3.26, v2.3.27, v2.3.28, v2.3.29, v2.3.3, v2.3.30, v2.3.31, v2.3.32, v2.3.33, v2.3.34, v2.3.35, v2.3.36, v2.3.37, v2.3.38, v2.3.39, v2.3.4, v2.3.40, v2.3.41, v2.3.42, v2.3.5, v2.3.6, v2.3.7, v2.3.8, v2.3.9, v2.4.0, v2.4.0-BETA1, v2.4.0-BETA2, v2.4.0-RC1, v2.4.1, v2.4.10, v2.4.2, v2.4.3, v2.4.4, v2.4.5, v2.4.6, v2.4.7, v2.4.8, v2.4.9, v2.5.0, v2.5.0-BETA1, v2.5.0-BETA2, v2.5.0-RC1, v2.5.1, v2.5.10, v2.5.11, v2.5.12, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9, v2.6.0, v2.6.0-BETA1, v2.6.0-BETA2, v2.6.1, v2.6.10, v2.6.11, v2.6.12, v2.6.13, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v2.6.9, v2.7.0, v2.7.0-BETA1, v2.7.0-BETA2, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.18, v2.7.19, v2.7.2, v2.7.20, v2.7.21, v2.7.22, v2.7.23, v2.7.24, v2.7.25, v2.7.26, v2.7.27, v2.7.28, v2.7.29, v2.7.3, v2.7.30, v2.7.31, v2.7.32, v2.7.33, v2.7.34, v2.7.35, v2.7.36, v2.7.37, v2.7.38, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.0-BETA1, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.19, v2.8.2, v2.8.20, v2.8.21, v2.8.22, v2.8.23, v2.8.24, v2.8.25, v2.8.26, v2.8.27, v2.8.28, v2.8.29, v2.8.3, v2.8.30, v2.8.31, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9, v3.0.0, v3.0.0-BETA1, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.0.7, v3.0.8, v3.0.9, v3.1.0, v3.1.0-BETA1, v3.1.0-RC1, v3.1.1, v3.1.10, v3.1.2, v3.1.3, v3.1.4, v3.1.5, v3.1.6, v3.1.7, v3.1.8, v3.1.9, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.10, v3.2.11, v3.2.12, v3.2.13, v3.2.14, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6, v3.2.7, v3.2.8, v3.2.9, v3.3.0, v3.3.0-BETA1, v3.3.0-RC1, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.0-BETA1, v3.4.0-BETA2, v3.4.0-BETA3, v3.4.0-BETA4, v3.4.0-RC1, v3.4.0-RC2] but these conflict with your requirements or minimum-stability.
    - Installation request for codeclimate/php-test-reporter 0.4.4 -> satisfiable by codeclimate/php-test-reporter[v0.4.4].

Phar Package not found

Steps required to reproduce the problem

a.
a.1. Edit your projects .travis.yml
a.2. add the wget command, mentinioned in the readme.md using the tester as Phar tool

b. or try to run the wget command on a linux shell

Expected Result

  • the phar file is downloaded

Actual Result

wget -c "https://github.com/codeclimate/php-test-reporter/releases/download/0.4.4/codeclimate-test-reporter.phar"
--2017-04-13 08:41:11--  https://github.com/codeclimate/php-test-reporter/releases/download/0.4.4/codeclimate-test-reporter.phar
Auflösen des Hostnamen »github.com (github.com)«... 192.30.253.113, 192.30.253.112
Verbindungsaufbau zu github.com (github.com)|192.30.253.113|:443... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 404 Not Found
2017-04-13 08:41:12 FEHLER 404: Not Found.

How to send a coverage report in JSON up to Code Climate directly.

Hi,
I'm working on a test framework for PHP (kahlan)

I was able to make it work with Coveralls & Scrutinizer but not for Code Climate yet.

What I'm generating right now with the framework is the following JSON:

https://gist.github.com/anonymous/c9f60c6161836237200a

which is related to the project: https://github.com/crysalead/kahlan

So I'm using the following command to upload the JSON up to Code Climate:

curl -X POST -d @codeclimate.json -H 'Content-Type: application/json' -H 'User-Agent: Code Climate (PHP Test Reporter v0.1.2)' https://codeclimate.com/test_reports

However even if in the console I get:

Test results saved.

nothing updated for the related project in code climate (https://codeclimate.com/repos/546c8563695680587e0912b9/feed)

Is there something obvious I'm missing / messed up ?

Thanks !

PHP error via travis.ci

I've just started trying to set up code climate and I think I finally got everything working but builds run via travis are failing with the following error:

PHP Parse error:  syntax error, unexpected 'foreach' (T_FOREACH) in /home/travis/build/gocodebox/lifterlms/vendor/codeclimate/php-test-reporter/composer/bin/test-reporter on line 13

Parse error: syntax error, unexpected 'foreach' (T_FOREACH) in /home/travis/build/gocodebox/lifterlms/vendor/codeclimate/php-test-reporter/composer/bin/test-reporter on line 13

I tried to fix this locally but I can't get it to successfully run via command line either, hitting namespace errors when I try to execute the file at ./vendor/bin/test-reporter.

I tried to get a .phar to try it that way but I can't find .phars in any of the releases here

Thanks,

Test reporter endpoint is returning a 413 Request Entity Too Large error

I am trying to send my code coverage report from PhpUnit through the test reporter. I am following the steps defined in docs and am generating a codeclimate.json file. The generated file is only 1.1MB and is being sent via cURL.

In the troubleshooting documentation it states that

The size of the coverage payload exceeds our limit, which is currently 3MB. Unfortunately we don't yet have a workaround to this issue.

Is that 3MB value incorrect, or am I doing something else wrong?

"Could not be resolve to an installable set of packages."

Attempt to install the package is causing my composer installation to fail. No longer able to send test coverage.

User: ~/dir: composer require --dev codeclimate/php-test-reporter dev-master
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for codeclimate/php-test-reporter dev-master -> satisfiable by codeclimate/php-test-reporter[dev-master].
    - codeclimate/php-test-reporter dev-master requires satooshi/php-coveralls 0.6.* -> satisfiable by satooshi/php-coveralls[v0.6.0, v0.6.1].
    - satooshi/php-coveralls v0.6.0 requires psr/log 1.0.0 -> satisfiable by psr/log[1.0.0].
    - satooshi/php-coveralls v0.6.1 requires psr/log 1.0.0 -> satisfiable by psr/log[1.0.0].
    - Conclusion: don't install psr/log 1.0.0

Running PHP 5.6.11

Other packages are:

"require": {
    "ddeboer/data-import": "@stable"
},
"require-dev": {
    "phpunit/phpunit": "4.6.*",
    "phpdocumentor/phpdocumentor": "dev-master"
},

No info about travis addon

No info about how to configure travis addon to use custom coverage-report file
(test-reporter [--coverage-report COVERAGE-REPORT])

For example:

addons:
    code_climate:
        repo_token: ****
        coverage_report: tests/logs/clover.xml

Failed to load external entity

My travis.yaml is almost identical to the one for this project and yet I get the horrible error output that clover.xml is not found: https://travis-ci.org/carbontwelve/tapestry/jobs/191265093#L269

PHP Warning:  simplexml_load_file(): I/O warning : failed to load external entity "/home/travis/build/carbontwelve/tapestry/build/logs/clover.xml" in /home/travis/build/carbontwelve/tapestry/vendor/satooshi/php-coveralls/src/Satooshi/Bundle/CoverallsV1Bundle/Api/Jobs.php on line 53

The command "vendor/bin/phpunit --coverage-clover=build/logs/clover.xml" exited with 0 and is the same command that php-test-reporter uses itself.

As an aside to this, shouldn't the tool provide a pretty error and exit when it first identifies that it cant find the xml file?

Minimum stability

Hi,

The last tagged version is now old, and so we must use dev-master (and minimum-stability dev) to get the last updates.

Can't you tag a new release?

Thanks,

Support for php 8

It seems that there is no version tagged yet as compatible with php 8

Specify CODECLIMATE_REPO_TOKEN so coverage can be reported

As you can see in https://travis-ci.org/codeclimate/php-test-reporter/jobs/191031087#L278, the environment variable CODECLIMATE_REPO_TOKEN hasn't been set.

There are two options

Related to #68.

💁‍♂️ For reference, see

Sending coverage to custom server sets Host header to codeclimate.com

Steps required to reproduce the problem

  1. Setup custom server at URL that is not codeclimate.com
  2. Run code coverage with env CODECLIMATE_API_HOST set to that URL
  3. Observe request headers

Expected Result

  • Host header should be customizable or default to the host of URL set in CODECLIMATE_API_HOST. For example, if the env var is set to https://codeclimate.mydomain.com then Host header should be set to codeclimate.mydomain.com.
  • The other option is to just remove the hard-coded Host header.

Actual Result

  • Host header is always codeclimate.com, which may cause custom server to redirect or not work if the custom server rejects invalid Host header names.

Remove dependency on Coveralls

We rely on classes from satooshi/php-coveralls for converting Clover XML to the proper JSON payload for our API endpoint. It would be good to just (re)write the logic we do rely on and remove that dependency.

Example Input:

<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1365848893">
  <project timestamp="1365848893">
    <package name="Hoge">
      <file name="/home/patrick/Code/codeclimate/php-test-reporter/src/CodeClimate/Bundle/TestReporterBundle/ApiClient.php">
        <class name="TestFile" namespace="Hoge">
          <metrics methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="1" coveredstatements="0" elements="2" coveredelements="0"/>
        </class>
        <line num="6" type="method" name="__construct" crap="1" count="0"/>
        <line num="8" type="stmt" count="0"/>
      </file>
    </package>
  </project>
</coverage>

The API endpoint for reporting coverage is shared across all test reporters for all languages, so this format must be maintained.

Example Output:

{
  "partial": false,
  "run_at": 1365848893,
  "repo_token": "...",
  "environment": {
    "pwd": "\/home\/patrick\/Code\/codeclimate\/php-test-reporter",
    "package_version": "0.1.0-dev"
  },
  "git":{
    "head": "7e3f3495218f92ad5ce847248e306f279b11a9f9",
    "branch": "pb-bundled-cert",
    "committed_at": 1404230153
  },
  "ci_service": "travis",
  "source_files": [{
    "name": "src\/CodeClimate\/Bundle\/TestReporterBundle\/ApiClient.php",
    "blob_id": "272fdc7fbbcd2d99f99db2f4fa59747ed2f35b05",
    "coverage":"[null, 0, null, 1, null, 3, null, 0, ...]"
  },{ 
    // ...
  }]
}

Values in JSON not from XML:

  • Environment information (CWD, token, CI service, etc)
  • Git information (head, branch, blob ids, etc)

Give @localheinz commit bit

@localheinz what do you think?

Things wouldn't change too much; still the general PR, review, merge process, but:

  • You could make your branches in this repo
  • You could merge them yourself (after a 👍)
  • You could/should review and merge other outside contributions
  • You could handle tagging and releasing, to some degree

Since we don't have much PHP expertise on the team, we could certainly use another voice steering this repository.

/cc @dblandin @maxjacobson

Malformed payload

We've received a report of a user struggling to set up php test coverage, and with their permission, took a look at the payload being sent by the php-test-reporter. Here's a little node.js script showing some characteristics of the payload we're receiving:

var fs = require('fs');
var data = JSON.parse(fs.readFileSync("./payload.json", "utf8"));

console.log(typeof data.coverage_data.source_files);
// object

console.log(Object.keys(data.coverage_data.source_files).slice(0, 2));
//[ '/opt/atlassian/pipelines/agent/build/src/Api.php',
//  '/opt/atlassian/pipelines/agent/build/src/ApiHandler.php' ]

console.log(data.coverage_data.source_files['/opt/atlassian/pipelines/agent/build/src/Api.php']);
// { name: 'src/Api.php',
//  coverage: '[null,null,null,null,null,null,null,null,null,null,null,null]',
//  blob_id: 'f4d95e0cb279952a0569e6f734cb0a2bc22ad864' }

You can see that data.coverage_data.source_files is an object, but that's malformed -- it should be an array. We don't need the keys in that object at all, we just want the values.

I'm not sure why this is happening, or if it's affecting many users or just this one. Is it possible that a user is getting different dependency versions or using a different version of php, and that could lead to this issue?

It looks like this repo doesn't have very many tests, so I think we ought to add some that exercise the format of the payload, to help smoke out if there is a bug there.

x

x

Provide missing GITHUB_API_KEY for Travis CI integration

Steps required to reproduce the problem

  1. tag a commit and push to origin (or tag it via GitHub UI)

Expected Result

  • a PHAR is automatically created on the PHP5.3 build on Travis, see .travis.yml

Actual Result

  • a PHAR isn't automatically created because the GITHUB_API_KEY environment variable doesn't exist, see for example Job #312.2

Related to #54.

💁‍♂️ What needs to be done here is

❗️ Danger zone, make sure to securely add this token, it should not be exposed to anyone (unless it is encrypted into .travis.yml).

Not compatible ved Php7.1

Steps required to reproduce the problem

  1. composer install

composer.json states:
"php": "^5.3 || ^7.0",
"symfony/console": "^2.0 || ^3.0 || ^4.0"

symfony/service-contracts claims:
symfony/service-contracts v2.0.1 requires php ^7.2.5

Expected Result

Composer to complete successfully

Actual Result

Your requirements could not be resolved to an installable set of packages.

Problem 1
- symfony/service-contracts v2.0.1 requires php ^7.2.5 -> your PHP version (7.1.30) does not satisfy that requirement.
- symfony/service-contracts v2.0.1 requires php ^7.2.5 -> your PHP version (7.1.30) does not satisfy that requirement.
- Installation request for symfony/service-contracts v2.0.1 -> satisfiable by symfony/service-contracts[v2.0.1].

Tag master branch

Hi,

Would it be possible to create a tag v0.1.0 on whats currently master branch? Otherwise I'm running into composer stability issues while installing your package and I can not use "minimum-stability": "dev" in my project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.