Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@ install:

test_script:
- cd c:\projects\behat-code-coverage
- bin\phpcs
- phpdbg -qrr vendor\phpunit\phpunit\phpunit -vvv

4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ before_script:
- composer validate
- if [[ $deps = low ]]; then composer update --prefer-lowest --prefer-stable; else composer update; fi

script: ./bin/phpunit -vvv
script:
- ./bin/phpcs
- ./bin/phpunit -vvv

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Version constraints in composer.json have been updated from `~` to `^`.


## [3.2.1] - 2018-03-19

- Fix Text report generation #5

## [3.2.0] - 2017-10-17 - Guzzle 6.0 support release

- Updated `guzzlehttp/guzzle` requirement from `~4.0||~5.0` to `~6.0`. We are
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
},
"require-dev": {
"phpunit/phpunit": "^6.0",
"mikey179/vfsStream": "1.6.*"
"mikey179/vfsStream": "1.6.*",
"squizlabs/php_codesniffer": "^3.2",
"escapestudios/symfony2-coding-standard": "^3.1"
},
"suggest": {
"ext-xdebug": "Xdebug extension is required to collect coverage via Xdebug driver and run tests",
Expand Down
20 changes: 20 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!-- leanphp/common-dev phpcs.xml example config -->
<ruleset name="LeanPHP Coding Standard">
<description>LeanPHP Coding Standard</description>

<!-- directories and files to scan -->
<file>src</file>

<!-- directories and files to exclude -->
<exclude-pattern>test</exclude-pattern>
<exclude-pattern>tests</exclude-pattern>
<exclude-pattern>*Spec.php</exclude-pattern>

<!-- uncomment for a summary instead of detailed report -->
<!--<arg name="report" value="summary"/>-->
<arg value="p"/>>

<!-- Use Symfony2 Coding Standard -->
<rule ref="vendor/escapestudios/symfony2-coding-standard/Symfony"/>
</ruleset>
1 change: 1 addition & 0 deletions src/Common/Driver/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Code Coverage Driver Factory
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/

Expand Down
3 changes: 2 additions & 1 deletion src/Common/Driver/HHVM.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* HHVM Code Coverage Driver
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/

Expand All @@ -27,7 +28,7 @@ class HHVM implements DriverInterface
*/
public function __construct()
{
if ( ! defined('HPHP_VERSION')) {
if (! defined('HPHP_VERSION')) {
throw new \SebastianBergmann\CodeCoverage\RuntimeException('This driver requires HHVM');
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Common/Driver/Stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Code Coverage Stub Driver
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/

Expand Down
3 changes: 2 additions & 1 deletion src/Common/Driver/XCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* XCache Code Coverage Driver
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/

Expand All @@ -26,7 +27,7 @@ class XCache implements DriverInterface
*/
public function __construct()
{
if ( ! extension_loaded('xcache')) {
if (! extension_loaded('xcache')) {
throw new \SebastianBergmann\CodeCoverage\RuntimeException('This driver requires XCache');
}

Expand Down
5 changes: 3 additions & 2 deletions src/Common/Model/Aggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Aggregate
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/

Expand Down Expand Up @@ -36,14 +37,14 @@ public function __construct()
*/
public function update($class, array $counts)
{
if ( ! isset($this->coverage[$class])) {
if (! isset($this->coverage[$class])) {
$this->coverage[$class] = $counts;

return;
}

foreach ($counts as $line => $status) {
if ( ! isset($this->coverage[$class][$line]) || $status > 0) {
if (! isset($this->coverage[$class][$line]) || $status > 0) {
// converts "hits" to "status"
$status = ! $status ? -1 : ($status > 1 ? 1 : $status);

Expand Down
5 changes: 3 additions & 2 deletions src/Common/Report/Clover.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Code Coverage Clover Report
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/

Expand Down Expand Up @@ -34,11 +35,11 @@ class Clover implements ReportInterface
*/
public function __construct(array $options)
{
if ( ! isset($options['target'])) {
if (! isset($options['target'])) {
$options['target'] = null;
}

if ( ! isset($options['name'])) {
if (! isset($options['name'])) {
$options['name'] = null;
}

Expand Down
8 changes: 5 additions & 3 deletions src/Common/Report/Crap4j.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Code Coverage Crap4j Report
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/

Expand All @@ -11,6 +12,7 @@
use LeanPHP\Behat\CodeCoverage\Common\ReportInterface;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Report\Crap4j as Crap4jReport;

/**
* Crap4j report
*
Expand All @@ -33,15 +35,15 @@ class Crap4j implements ReportInterface
*/
public function __construct(array $options)
{
if ( ! class_exists('SebastianBergmann\CodeCoverage\Report\Crap4j')) {
if (! class_exists('SebastianBergmann\CodeCoverage\Report\Crap4j')) {
throw new \Exception('Crap4j requires CodeCoverage 4.0+');
}

if ( ! isset($options['target'])) {
if (! isset($options['target'])) {
$options['target'] = null;
}

if ( ! isset($options['name'])) {
if (! isset($options['name'])) {
$options['name'] = null;
}

Expand Down
3 changes: 2 additions & 1 deletion src/Common/Report/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Code Coverage Report Factory
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/

Expand All @@ -26,7 +27,7 @@ class Factory
public function create($reportType, array $options)
{
if (in_array($reportType, array('clover', 'crap4j', 'html', 'php', 'text', 'xml'))) {
$className = '\LeanPHP\Behat\CodeCoverage\Common\Report\\' . ucfirst($reportType);
$className = '\LeanPHP\Behat\CodeCoverage\Common\Report\\'.ucfirst($reportType);

return new $className($options);
}
Expand Down
13 changes: 7 additions & 6 deletions src/Common/Report/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Code Coverage HTML Report
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/

Expand Down Expand Up @@ -34,27 +35,27 @@ class Html implements ReportInterface
*/
public function __construct(array $options)
{
if ( ! isset($options['target'])) {
if (! isset($options['target'])) {
$options['target'] = null;
}

if ( ! isset($options['charset'])) {
if (! isset($options['charset'])) {
$options['charset'] = 'UTF-8';
}

if ( ! isset($options['highlight'])) {
if (! isset($options['highlight'])) {
$options['highlight'] = false;
}

if ( ! isset($options['lowUpperBound'])) {
if (! isset($options['lowUpperBound'])) {
$options['lowUpperBound'] = 35;
}

if ( ! isset($options['highUpperBound'])) {
if (! isset($options['highUpperBound'])) {
$options['highUpperBound'] = 70;
}

if ( ! isset($options['generator'])) {
if (! isset($options['generator'])) {
$options['generator'] = '';
}

Expand Down
3 changes: 2 additions & 1 deletion src/Common/Report/Php.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Code Coverage PHP Report
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/

Expand Down Expand Up @@ -34,7 +35,7 @@ class Php implements ReportInterface
*/
public function __construct(array $options)
{
if ( ! isset($options['target'])) {
if (! isset($options['target'])) {
$options['target'] = null;
}

Expand Down
18 changes: 12 additions & 6 deletions src/Common/Report/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Code Coverage Text Report
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/

Expand Down Expand Up @@ -34,23 +35,23 @@ class Text implements ReportInterface
*/
public function __construct(array $options)
{
if ( ! isset($options['showColors'])) {
if (! isset($options['showColors'])) {
$options['showColors'] = false;
}

if ( ! isset($options['printer'])) {
if (! isset($options['printer'])) {
$options['printer'] = null;
}

if ( ! isset($options['lowUpperBound'])) {
if (! isset($options['lowUpperBound'])) {
$options['lowUpperBound'] = 35;
}

if ( ! isset($options['highUpperBound'])) {
if (! isset($options['highUpperBound'])) {
$options['highUpperBound'] = 70;
}

if ( ! isset($options['showUncoveredFiles'])) {
if (! isset($options['showUncoveredFiles'])) {
$options['showUncoveredFiles'] = false;
}

Expand All @@ -64,7 +65,7 @@ public function __construct(array $options)
$options['showUncoveredFiles']
);
} else {
if ( ! isset($options['showOnlySummary'])) {
if (! isset($options['showOnlySummary'])) {
$options['showOnlySummary'] = false;
}

Expand All @@ -90,6 +91,11 @@ public function process(CodeCoverage $coverage)
);
}

/**
* return version of CodeCoverage
*
* @return string
*/
private function getVersion()
{
$reflectionMethod = new \ReflectionMethod('SebastianBergmann\CodeCoverage\Report\Text', '__construct');
Expand Down
7 changes: 4 additions & 3 deletions src/Common/Report/Xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
* Code Coverage XML Report
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/

namespace LeanPHP\Behat\CodeCoverage\Common\Report;

use LeanPHP\Behat\CodeCoverage\Common\ReportInterface;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Report\Xml\Facade;;
use SebastianBergmann\CodeCoverage\Report\Xml\Facade;

/**
* XML report
Expand All @@ -34,11 +35,11 @@ class Xml implements ReportInterface
*/
public function __construct(array $options)
{
if ( ! class_exists('SebastianBergmann\CodeCoverage\Report\Xml\Facade')) {
if (! class_exists('SebastianBergmann\CodeCoverage\Report\Xml\Facade')) {
throw new \Exception('XML requires CodeCoverage 4.0+');
}

if ( ! isset($options['target'])) {
if (! isset($options['target'])) {
$options['target'] = null;
}

Expand Down
1 change: 1 addition & 0 deletions src/Common/ReportInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Report
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/

Expand Down
1 change: 1 addition & 0 deletions src/Compiler/DriverPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Driver Compiler Pass
*
* @copyright 2013 Anthon Pang
*
* @license BSD-2-Clause
*/

Expand Down
1 change: 1 addition & 0 deletions src/Compiler/FactoryPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Factory Compiler Pass
*
* @copyright 2013 Anthon Pang
*
* @license BSD-2-Clause
*/

Expand Down
Loading