Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCOV fix #98

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ jobs:
- phpenv config-rm xdebug.ini || return 0
- composer global show hirak/prestissimo -q || composer global require hirak/prestissimo
- |
git clone --branch=release --depth=1 https://github.com/krakjoe/pcov
git clone --branch=develop --depth=1 https://github.com/krakjoe/pcov
cd pcov
phpize
./configure
make clean install
echo "extension=pcov.so" > $HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/etc/conf.d/pcov.ini
cd $TRAVIS_BUILD_DIR
install: composer require --dev php-coveralls/php-coveralls
install:
- composer require --dev php-coveralls/php-coveralls
- cp _tmp/PCOV.php vendor/phpunit/php-code-coverage/src/Driver/PCOV.php
script: composer test -- --coverage-clover=build/logs/clover.xml
after_success: vendor/bin/php-coveralls

Expand Down
55 changes: 55 additions & 0 deletions _tmp/PCOV.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\CodeCoverage\Driver;

use SebastianBergmann\CodeCoverage\Filter;

/**
* Driver for PCOV code coverage functionality.
*
* @codeCoverageIgnore
*/
final class PCOV implements Driver
{
public function __construct(Filter $filter = null)
{
}

/**
* Start collection of code coverage information.
*/
public function start(bool $determineUnusedAndDead = true): void
{
\pcov\start();
}

/**
* Stop collection of code coverage information.
*/
public function stop(): array
{
\pcov\stop();

$waiting = \pcov\waiting();
$collect = [];

if ($waiting) {
$collect = \pcov\collect(\pcov\inclusive, $waiting);

if ($collect) {
\pcov\clear(\pcov\coverage | \pcov\waiting);
} else {
\pcov\clear(\pcov\waiting);
}
}

return $collect;
}
}