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
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ language: php

matrix:
include:
- php: 5.3
- php: 5.4
- php: 5.5
- php: 5.6
- php: 5.6
env: deps=low
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [3.1.x-dev] - UNRELEASED

- Update PHP requirement to `>=5.6` (from `>=5.3.10`)
- Update `phpunit/php-code-coverage` from `~2.2` to `~4.0||~5.0`.
- Add/implement missing tests for Xml and Crap4j reporters
- Mark `phpdbg` or `xdebug` specific tests so they are skipped automatically
(using phpunit's @requires).

## [3.0.0] - 2017-04-08 (backported `3.0.x-dev` + patches)

- Fixed compatibility with Symfony `2.x` and `3.x` #2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ compatible version numbers for stable releases.

## Requirements

- PHP 5.3.10+ / 7.0+
- PHP 5.6+ / 7.0+
- [Behat v3][3]
- [Xdebug][5] or [phpdbg][6] extension enabled (PHP 7+ is required for code
generation to work with [phpdbg][6]).
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"docs": "https://github.com/leanphp/behat-code-coverage#behat-code-coverage"
},
"require": {
"php": ">=5.3.10",
"phpunit/php-code-coverage": "2.2.*",
"php": ">=5.6",
"phpunit/php-code-coverage": "~4.0||~5.0",
"behat/behat": "~3.0",
"guzzlehttp/guzzle": "~3.0",
"symfony/config": "~2.3||~3.0",
Expand All @@ -36,7 +36,7 @@
"symfony/http-foundation": "~2.3||~3.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpunit/phpunit": "~5.0",
"mikey179/vfsStream": "1.3.*"
},
"suggest": {
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Driver/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace LeanPHP\Behat\CodeCoverage\Common\Driver;

use PHP_CodeCoverage_Driver as DriverInterface;
use SebastianBergmann\CodeCoverage\Driver\Driver as DriverInterface;

/**
* Driver factory
Expand Down
11 changes: 6 additions & 5 deletions src/Common/Driver/HHVM.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

namespace LeanPHP\Behat\CodeCoverage\Common\Driver;

use PHP_CodeCoverage_Driver as DriverInterface;
use SebastianBergmann\CodeCoverage\Driver\Driver as DriverInterface;
use SebastianBergmann\CodeCoverage\CodeCoverage;

/**
* HHVM (Hip Hop VM) Driver
*
* {@internal Derived from PHP_CodeCoverage_Driver_Xdebug.}
* {@internal Derived from SebastianBergmann\CodeCoverage\Driver\Xdebug.}
*
* @author Anthon Pang <[email protected]>
*/
Expand All @@ -22,19 +23,19 @@ class HHVM implements DriverInterface
/**
* Constructor
*
* @throws \PHP_CodeCoverage_Exception if PHP code coverage not enabled
* @throws SebastianBergmann\CodeCoverage\RuntimeException if PHP code coverage not enabled
*/
public function __construct()
{
if ( ! defined('HPHP_VERSION')) {
throw new \PHP_CodeCoverage_Exception('This driver requires HHVM');
throw new \SebastianBergmann\CodeCoverage\RuntimeException('This driver requires HHVM');
}
}

/**
* {@inheritdoc}
*/
public function start()
public function start($determineUnusedAndDead = true)
{
fb_enable_code_coverage();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Common/Driver/Stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace LeanPHP\Behat\CodeCoverage\Common\Driver;

use PHP_CodeCoverage_Driver as DriverInterface;
use SebastianBergmann\CodeCoverage\Driver\Driver as DriverInterface;

/**
* Stub driver
Expand Down Expand Up @@ -42,7 +42,7 @@ public function getDriver()
/**
* {@inheritdoc}
*/
public function start()
public function start($determineUnusedAndDead = true)
{
if ($this->driver) {
$this->driver->start();
Expand Down
12 changes: 6 additions & 6 deletions src/Common/Driver/XCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

namespace LeanPHP\Behat\CodeCoverage\Common\Driver;

use PHP_CodeCoverage_Driver as DriverInterface;
use SebastianBergmann\CodeCoverage\Driver\Driver as DriverInterface;

/**
* XCache Driver
*
* {@internal Derived from PHP_CodeCoverage_Driver_Xdebug.}
* {@internal Derived from SebastianBergmann\CodeCoverage\Driver\Xdebug.}
*
* @author Anthon Pang <[email protected]>
*/
Expand All @@ -22,25 +22,25 @@ class XCache implements DriverInterface
/**
* Constructor
*
* @throws \PHP_CodeCoverage_Exception if PHP code coverage not enabled
* @throws \SebastianBergmann\CodeCoverage\RuntimeException if PHP code coverage not enabled
*/
public function __construct()
{
if ( ! extension_loaded('xcache')) {
throw new \PHP_CodeCoverage_Exception('This driver requires XCache');
throw new \SebastianBergmann\CodeCoverage\RuntimeException('This driver requires XCache');
}

if (version_compare(phpversion('xcache'), '1.2.0', '<') ||
! ini_get('xcache.coverager')
) {
throw new \PHP_CodeCoverage_Exception('xcache.coverager=On has to be set in php.ini');
throw new \SebastianBergmann\CodeCoverage\RuntimeException('xcache.coverager=On has to be set in php.ini');
}
}

/**
* {@inheritdoc}
*/
public function start()
public function start($determineUnusedAndDead = true)
{
xcache_coverager_start();
}
Expand Down
8 changes: 5 additions & 3 deletions src/Common/Report/Clover.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
namespace LeanPHP\Behat\CodeCoverage\Common\Report;

use LeanPHP\Behat\CodeCoverage\Common\ReportInterface;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Report\Clover as CloverReport;

/**
* Clover report
Expand All @@ -18,7 +20,7 @@
class Clover implements ReportInterface
{
/**
* @var \PHP_CodeCoverage_Report_Clover
* @var \SebastianBergmann\CodeCoverage\Report\Clover
*/
private $report;

Expand All @@ -40,14 +42,14 @@ public function __construct(array $options)
$options['name'] = null;
}

$this->report = new \PHP_CodeCoverage_Report_Clover();
$this->report = new CloverReport();
$this->options = $options;
}

/**
* {@inheritdoc}
*/
public function process(\PHP_CodeCoverage $coverage)
public function process(CodeCoverage $coverage)
{
return $this->report->process(
$coverage,
Expand Down
13 changes: 7 additions & 6 deletions src/Common/Report/Crap4j.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
namespace LeanPHP\Behat\CodeCoverage\Common\Report;

use LeanPHP\Behat\CodeCoverage\Common\ReportInterface;

use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Report\Crap4j as Crap4jReport;
/**
* Crap4j report
*
Expand All @@ -18,7 +19,7 @@
class Crap4j implements ReportInterface
{
/**
* @var \PHP_CodeCoverage_Report_Crap4j
* @var SebastianBergmann\CodeCoverage\Report\Crap4j
*/
private $report;

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

if ( ! isset($options['target'])) {
Expand All @@ -44,14 +45,14 @@ public function __construct(array $options)
$options['name'] = null;
}

$this->report = new \PHP_CodeCoverage_Report_Crap4j();
$this->report = new Crap4jReport();
$this->options = $options;
}

/**
* {@inheritdoc}
*/
public function process(\PHP_CodeCoverage $coverage)
public function process(CodeCoverage $coverage)
{
return $this->report->process(
$coverage,
Expand Down
10 changes: 5 additions & 5 deletions src/Common/Report/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
namespace LeanPHP\Behat\CodeCoverage\Common\Report;

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

/**
* HTML report
Expand All @@ -18,7 +20,7 @@
class Html implements ReportInterface
{
/**
* @var \PHP_CodeCoverage_Report_HTML
* @var Facade
*/
private $report;

Expand Down Expand Up @@ -56,9 +58,7 @@ public function __construct(array $options)
$options['generator'] = '';
}

$this->report = new \PHP_CodeCoverage_Report_HTML(
$options['charset'],
$options['highlight'],
$this->report = new Facade(
$options['lowUpperBound'],
$options['highUpperBound'],
$options['generator']
Expand All @@ -70,7 +70,7 @@ public function __construct(array $options)
/**
* {@inheritdoc}
*/
public function process(\PHP_CodeCoverage $coverage)
public function process(CodeCoverage $coverage)
{
return $this->report->process(
$coverage,
Expand Down
8 changes: 5 additions & 3 deletions src/Common/Report/Php.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
namespace LeanPHP\Behat\CodeCoverage\Common\Report;

use LeanPHP\Behat\CodeCoverage\Common\ReportInterface;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Report\PHP as PHPReport;

/**
* PHP report
Expand All @@ -18,7 +20,7 @@
class Php implements ReportInterface
{
/**
* @var \PHP_CodeCoverage_Report_Clover
* @var \SebastianBergmann\CodeCoverage\Report\Clover
*/
private $report;

Expand All @@ -36,14 +38,14 @@ public function __construct(array $options)
$options['target'] = null;
}

$this->report = new \PHP_CodeCoverage_Report_PHP();
$this->report = new PHPReport();
$this->options = $options;
}

/**
* {@inheritdoc}
*/
public function process(\PHP_CodeCoverage $coverage)
public function process(CodeCoverage $coverage)
{
return $this->report->process(
$coverage,
Expand Down
12 changes: 7 additions & 5 deletions src/Common/Report/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
namespace LeanPHP\Behat\CodeCoverage\Common\Report;

use LeanPHP\Behat\CodeCoverage\Common\ReportInterface;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Report\Text as TextReport;

/**
* Text report
Expand All @@ -18,7 +20,7 @@
class Text implements ReportInterface
{
/**
* @var \PHP_CodeCoverage_Report_Text
* @var \SebastianBergmann\CodeCoverage\Report\Text
*/
private $report;

Expand Down Expand Up @@ -55,7 +57,7 @@ public function __construct(array $options)
if ($this->getVersion() === '1.2') {
$outputStream = new \PHPUnit_Util_Printer($options['printer']);

$this->report = new \PHP_CodeCoverage_Report_Text(
$this->report = new TextReport(
$outputStream,
$options['lowUpperBound'],
$options['highUpperBound'],
Expand All @@ -66,7 +68,7 @@ public function __construct(array $options)
$options['showOnlySummary'] = false;
}

$this->report = new \PHP_CodeCoverage_Report_Text(
$this->report = new TextReport(
$options['lowUpperBound'],
$options['highUpperBound'],
$options['showUncoveredFiles'],
Expand All @@ -80,7 +82,7 @@ public function __construct(array $options)
/**
* {@inheritdoc}
*/
public function process(\PHP_CodeCoverage $coverage)
public function process(CodeCoverage $coverage)
{
return $this->report->process(
$coverage,
Expand All @@ -90,7 +92,7 @@ public function process(\PHP_CodeCoverage $coverage)

private function getVersion()
{
$reflectionMethod = new \ReflectionMethod('PHP_CodeCoverage_Report_Text', '__construct');
$reflectionMethod = new \ReflectionMethod('SebastianBergmann\CodeCoverage\Report\Text', '__construct');
$parameters = $reflectionMethod->getParameters();

if (reset($parameters)->name === 'outputStream') {
Expand Down
Loading