Skip to content

Commit 5787439

Browse files
committed
v3.4.0 - php-code-coverage v6.0 support
1 parent e49b76b commit 5787439

File tree

15 files changed

+74
-28
lines changed

15 files changed

+74
-28
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ language: php
22

33
matrix:
44
include:
5-
- php: 7.0
6-
- php: 7.0
7-
deps: low
85
- php: 7.1
96
- php: 7.1
107
deps: low

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ documented in this file.
66
The format is based on [Keep a Changelog](http://keepachangelog.com/)
77
and this project adheres to [Semantic Versioning](http://semver.org/).
88

9+
## [3.4.0] - 2018-05-04
10+
11+
- Require PHP 7.1 and php-code-coverage ^6.0.
12+
- Fixes for Drivers to support php-code-coverage ^6.0.
13+
- Updated require-dev to use phpunit v7.0
14+
915
## [3.3.1] - 2018-05-04
1016

1117
- Fix compatibility with `phpunit/php-code-coverage:^6.0`, only leaving support

behat.yml.dist

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,13 @@ default:
1010
format: html
1111
options:
1212
target: build/coverage-behat
13+
html:
14+
options:
15+
target: build/coverage-behat
16+
php:
17+
options:
18+
target: build/coverage-behat.php
19+
crap4j:
20+
options:
21+
target: build/coverage-behat.crap4j
22+

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"require": {
2828
"php": ">=5.6",
29-
"phpunit/php-code-coverage": "^5.0",
29+
"phpunit/php-code-coverage": "^5.0,<6.0",
3030
"behat/behat": "^3.0",
3131
"guzzlehttp/guzzle": "^6.0",
3232
"symfony/config": "^2.3||^3.0||^4.0",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
use Behat\Behat\Context\Context;
4+
use Behat\Gherkin\Node\PyStringNode;
5+
use Behat\Gherkin\Node\TableNode;
6+
7+
/**
8+
* Defines application features from the specific context.
9+
*/
10+
class FeatureContext implements Context
11+
{
12+
/**
13+
* Initializes context.
14+
*
15+
* Every scenario gets its own context instance.
16+
* You can also pass arbitrary arguments to the
17+
* context constructor through behat.yml.
18+
*/
19+
public function __construct()
20+
{
21+
}
22+
}

features/test.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Feature: Listing command
2+
In order to change the structure of the folder I am currently in
3+
As a UNIX user
4+
I need to be able see the currently available files and folders there
5+
6+
Scenario: Listing two files in a directory
7+
Given I am in a directory "test"
8+
When I run "ls"
9+
Then I should get "bla"

src/Common/Driver/HHVM.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,22 @@ public function __construct()
3636
/**
3737
* {@inheritdoc}
3838
*/
39-
public function start($determineUnusedAndDead = true)
39+
public function start($determineUnusedAndDead = true): void
4040
{
4141
fb_enable_code_coverage();
4242
}
4343

4444
/**
4545
* {@inheritdoc}
4646
*/
47-
public function stop()
47+
public function stop(): array
4848
{
4949
$codeCoverage = fb_get_code_coverage(true);
5050

51+
if (null === $codeCoverage) {
52+
$codeCoverage = [];
53+
}
54+
5155
fb_disable_code_coverage();
5256

5357
return $codeCoverage;

src/Common/Driver/Stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function getDriver()
4343
/**
4444
* {@inheritdoc}
4545
*/
46-
public function start($determineUnusedAndDead = true)
46+
public function start($determineUnusedAndDead = true): void
4747
{
4848
if ($this->driver) {
4949
$this->driver->start();
@@ -53,7 +53,7 @@ public function start($determineUnusedAndDead = true)
5353
/**
5454
* {@inheritdoc}
5555
*/
56-
public function stop()
56+
public function stop(): array
5757
{
5858
return $this->driver ? $this->driver->stop() : false;
5959
}

src/Common/Driver/XCache.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,22 @@ public function __construct()
4141
/**
4242
* {@inheritdoc}
4343
*/
44-
public function start($determineUnusedAndDead = true)
44+
public function start($determineUnusedAndDead = true): void
4545
{
4646
xcache_coverager_start();
4747
}
4848

4949
/**
5050
* {@inheritdoc}
5151
*/
52-
public function stop()
52+
public function stop(): array
5353
{
5454
$codeCoverage = xcache_coverager_get();
5555

56+
if (null === $codeCoverage) {
57+
$codeCoverage = [];
58+
}
59+
5660
xcache_coverager_stop(true);
5761

5862
return $codeCoverage;

src/Common/Model/Aggregate.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,7 @@ class Aggregate
1919
/**
2020
* @var array
2121
*/
22-
private $coverage;
23-
24-
/**
25-
* Constructor
26-
*/
27-
public function __construct()
28-
{
29-
$this->coverage = array();
30-
}
22+
private $coverage = [];
3123

3224
/**
3325
* Update aggregated coverage

0 commit comments

Comments
 (0)