Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: codeclimate/php-test-reporter
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.4.0
Choose a base ref
...
head repository: codeclimate/php-test-reporter
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
29 changes: 29 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# CONTRIBUTING

We're using [Travis CI](https://travis-ci.com) as a continuous integration system.

For details, see [`.travis.yml`](../.travis.yml).

## Tests

We're using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development.

Run

```
$ composer test
```

to run all the tests.

## Coding Standards

We are using [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to enforce coding standards.

Run

```
$ composer cs
```

to automatically fix coding standard violations.
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#### Steps required to reproduce the problem

1.
2.
3.

#### Expected Result

*

#### Actual Result

*
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This PR

* [ ]
* [ ] has tests
* [ ] updates changelog if appropriate

Follows #.
Related to #.
Fixes #.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -3,5 +3,7 @@
Vagrantfile
build/
vendor/
.php_cs.cache
box.phar
composer.lock
composer.phar
15 changes: 15 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

$finder = PhpCsFixer\Finder::create()->in(__DIR__);

$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;

return PhpCsFixer\Config::create()
->setCacheFile($cacheDir . '/.php_cs.cache')
->setFinder($finder)
->setRules(array(
'@PSR2' => true,
'array_syntax' => array(
'syntax' => 'long',
),
));
52 changes: 47 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -3,24 +3,66 @@ language: php
sudo: false

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- nightly

os:
- linux

env:
- COMPOSER_FLAGS="--prefer-lowest"
- COMPOSER_FLAGS=""

matrix:
include:
- php: 5.3
env: BUILD_PHAR=true
- php: 7.1
env: COVERAGE=yes
- php: 7.1
env: EXECUTE_CS_CHECK=yes
allow_failures:
- php: nightly

cache:
directories:
- $HOME/.composer/cache
- $HOME/.php-cs-fixer

before_install:
- composer self-update
- source .travis/travis.sh
- if [[ $TRAVIS_PHP_VERSION != hhvm && $TRAVIS_PHP_VERSION != nightly && $COVERAGE != yes ]]; then phpenv config-rm xdebug.ini; fi
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo 'opcache.enable=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo 'opcache.enable_cli=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
- travis_retry composer self-update

install:
- composer install --prefer-dist
- travis_retry composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction $COMPOSER_FLAGS

before_script:
- git config --global user.email "travis-ci@codeclimate.com"
- git config --global user.name "Travis CI"
- mkdir -p "$HOME/.php-cs-fixer"

script:
- vendor/bin/phpunit
- composer validate
- if [[ $COVERAGE == yes ]]; then vendor/bin/phpunit --coverage-clover=build/logs/clover.xml; else vendor/bin/phpunit --no-coverage; fi
- if [[ $EXECUTE_CS_CHECK == yes ]]; then php -n -d memory_limit=768M vendor/bin/php-cs-fixer fix --config=.php_cs --verbose --diff --dry-run; fi

after_success:
- if [[ $COVERAGE == yes ]]; then php composer/bin/test-reporter; fi

after_script:
- php composer/bin/test-reporter
deploy:
provider: releases
api_key: $GITHUB_API_KEY
file: build/codeclimate-test-reporter.phar
skip_cleanup: true
on:
tags: true
php: 5.3
condition: "$BUILD_PHAR == true"
32 changes: 32 additions & 0 deletions .travis/travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

# The problem is that we do not want to remove the configuration file, just disable it for a few tasks, then enable it
#
# For reference, see
#
# - https://docs.travis-ci.com/user/languages/php#Disabling-preinstalled-PHP-extensions
# - https://docs.travis-ci.com/user/languages/php#Custom-PHP-configuration

config="/home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini"

function xdebug-disable() {
if [[ -f $config ]]; then
mv $config "$config.bak"
fi
}

function xdebug-enable() {
if [[ -f "$config.bak" ]]; then
mv "$config.bak" $config
fi
}

function run-tests() {
if [[ "$WITH_COVERAGE" == "true" ]]; then
xdebug-enable
vendor/bin/phpunit --coverage-clover=build/logs/clover.xml
xdebug-disable
else
vendor/bin/phpunit
fi
}
32 changes: 29 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,9 +3,35 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a CHANGELOG](http://keepachangelog.com).

## [Unreleased]
## [Unreleased](https://github.com/codeclimate/php-test-reporter/compare/v0.4.4...HEAD)

(nothing yet)
(add details here)

## [v0.4.4](https://github.com/codeclimate/php-test-reporter/compare/v0.4.3...v0.4.4)

### Fixed

- Format Gitlab CI payloads in the same way as we do in other test reporters ([#116](https://github.com/codeclimate/php-test-reporter/pull/116))

## [v0.4.3](https://github.com/codeclimate/php-test-reporter/compare/v0.4.2...v0.4.3)

### Added

- Added support for Gitlab CI ([#113](https://github.com/codeclimate/php-test-reporter/pull/113))

### Fixed

- Restore compatibility with PHP 5.3 ([@localheinz])

## [v0.4.2](https://github.com/codeclimate/php-test-reporter/compare/v0.4.1...v0.4.2)

### Fixed

- Fix bug in payload structure ([@localheinz])

## [v0.4.1](https://github.com/codeclimate/php-test-reporter/compare/v0.4.0...v0.4.1)

- Internal fixes to code, documentation, and packaging ([@localheinz])

## v0.4.0

@@ -17,4 +43,4 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a CH
- `rollback` command (PHAR only)
- [Installation / Usage](./README.md) / [Distribution instructions](./DEVELOPING.md) for the PHAR tool

[Unreleased]: https://github.com/codeclimate/php-test-reporter/compare/v0.4.0...HEAD
[@localheinz]: https://github.com/localheinz
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[![Code Climate](https://codeclimate.com/github/codeclimate/php-test-reporter.svg)](https://codeclimate.com/github/codeclimate/php-test-reporter)
[![Build Status](https://travis-ci.org/codeclimate/php-test-reporter.svg?branch=master)](https://travis-ci.org/codeclimate/php-test-reporter)
[![Code Climate](https://codeclimate.com/github/codeclimate/php-test-reporter.svg)](https://codeclimate.com/github/codeclimate/php-test-reporter)
[![Test Coverage](https://codeclimate.com/github/codeclimate/php-test-reporter/badges/coverage.svg)](https://codeclimate.com/github/codeclimate/php-test-reporter/coverage)

# codeclimate-test-reporter
# 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](https://docs.codeclimate.com/v1.0/docs/configuring-test-coverage) 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.
@@ -141,6 +144,8 @@ https://github.com/codeclimate/php-test-reporter

This package is maintained by Bryan Helmkamp (bryan@codeclimate.com).

For more details, see [`CONTRIBUTING.md`](.github/CONTRIBUTING.md).

## Copyright

See LICENSE.txt
3 changes: 1 addition & 2 deletions box.json
Original file line number Diff line number Diff line change
@@ -22,8 +22,7 @@
"exclude": [
"bin",
"tests",
"phpunit",
"tm"
"Tests"
],
"in": [
"vendor"
38 changes: 23 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
@@ -15,18 +15,20 @@
"homepage": "https://codeclimate.com"
}
],
"config": {
"sort-packages": true
},
"require": {
"php": ">=5.3",
"php": "^5.3 || ^7.0",
"ext-curl": "*",
"satooshi/php-coveralls": "^1.0",
"symfony/console": "^2.0|^3.0",
"padraic/phar-updater": "^1.0",
"psr/log": "^1.0",
"padraic/phar-updater": "^1.0"
"satooshi/php-coveralls": "^1.0",
"symfony/console": "^2.0 || ^3.0 || ^4.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*@stable",
"ext-xdebug": "*",
"tm/tooly-composer-script": "^1.0"
"friendsofphp/php-cs-fixer": "^2.0.0",
"phpunit/phpunit": "^4.8.35 || ^5.7.0 || ^6.0.0"
},
"autoload": {
"psr-4": {
@@ -42,18 +44,24 @@
"composer/bin/test-reporter"
],
"scripts": {
"post-install-cmd": "Tooly\\ScriptHandler::installPharTools",
"post-update-cmd": "Tooly\\ScriptHandler::installPharTools"
"box": [
"composer install --no-dev --prefer-dist",
"curl -LSs https://box-project.github.io/box2/installer.php | php",
"php box.phar --version",
"php box.phar build -v"
],
"cs": [
"composer install --prefer-dist",
"php-cs-fixer fix --config=.php_cs --verbose --diff"
],
"test": [
"composer install --prefer-dist",
"./vendor/bin/phpunit --configuration=phpunit.xml.dist"
]
},
"extra": {
"branch-alias": {
"dev-master": "0.3.x-dev"
},
"tools": {
"box": {
"url": "https://github.com/box-project/box2/releases/download/2.7.2/box-2.7.2.phar",
"only-dev": true
}
}
}
}
4 changes: 2 additions & 2 deletions composer/bin/test-reporter
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@ namespace CodeClimate\PhpTestReporter;

use CodeClimate\PhpTestReporter\Constants\Version;

$files = [
$files = array(
__DIR__ . '/../../vendor/autoload.php',
__DIR__ . '/../../../../autoload.php',
];
);

foreach ($files as $file) {
if (file_exists($file)) {
6 changes: 3 additions & 3 deletions phar/bin/main.php
Original file line number Diff line number Diff line change
@@ -10,16 +10,16 @@
use CodeClimate\PhpTestReporter\ConsoleCommands\UploadCommand;
use Symfony\Component\Console\Application;

require(__DIR__ . '/../../vendor/autoload.php');
require __DIR__ . '/../../vendor/autoload.php';

try {
$app = new Application('Code Climate PHP Test Reporter', '@package_version@');
$app->addCommands(
[
array(
new UploadCommand('upload'),
new SelfUpdateCommand('self-update'),
new RollbackCommand('rollback'),
]
)
);

$code = $app->run();
18 changes: 10 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php">
failOnWarning="true"
bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="PHP test reporter test suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>

<filter>
<whitelist>
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
<directory>./src</directory>
<exclude>
<directory>./composer</directory>
Loading