krakjoe / pcov

PCOV - CodeCoverage compatible driver for PHP
Other
697 stars 29 forks source link

'No code coverage driver available' although php reports pcov enabled #13

Closed ohnotnow closed 5 years ago

ohnotnow commented 5 years ago

Hi,

It's very, very likely I'm doing something wrong - so apologies in advance! I've installed the extension using pecl and added an ini entry with pcov.enabled = 1 just to be sure. When I run phpunit I get the above exception message back from the code coverage driver though. Things look ok to me :

$ php --version
PHP 7.2.17 (cli) (built: Apr  6 2019 03:22:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

$ php -m
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gmp
hash
iconv
json
ldap
libxml
mbstring
mysqlnd
openssl
pcntl
pcov
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
sysvmsg
tokenizer
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]

$ php --ri pcov

pcov

PCOV support => Enabled
PCOV version => 1.0.2
pcov.directory => auto
pcov.exclude => none
pcov.initial.memory => 65336 bytes
pcov.initial.files => 64

$ php vendor/bin/phpunit --coverage-text --colors=never

PHPUnit 7.5.9 by Sebastian Bergmann and contributors.

Fatal error: Uncaught SebastianBergmann\CodeCoverage\RuntimeException: No code coverage driver available in /builds/ohffs/glasgow_projects/vendor/phpunit/php-code-coverage/src/CodeCoverage.php:908
Stack trace:
#0 /builds/ohffs/glasgow_projects/vendor/phpunit/php-code-coverage/src/CodeCoverage.php(146): SebastianBergmann\CodeCoverage\CodeCoverage->selectDriver(Object(SebastianBergmann\CodeCoverage\Filter))
#1 /builds/ohffs/glasgow_projects/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(528): SebastianBergmann\CodeCoverage\CodeCoverage->__construct(NULL, Object(SebastianBergmann\CodeCoverage\Filter))
#2 /builds/ohffs/glasgow_projects/vendor/phpunit/phpunit/src/TextUI/Command.php(206): PHPUnit\TextUI\TestRunner->doRun(Object(PHPUnit\Framework\TestSuite), Array, true)
#3 /builds/ohffs/glasgow_projects/vendor/phpunit/phpunit/src/TextUI/Command.php(162): PHPUnit\TextUI\Command->run(Array, true)
#4 /builds/ohffs/glasgow_projects/vendor/phpunit/phpunit/phpunit(61): PHPUnit\TextUI\Command::main()
#5 {main}
  thrown in /builds/ohffs/glasgow_projects/vendor/phpunit/php-code-coverage/src/CodeCoverage.php on line 908
ERROR: Job failed: exit code 1
lukas9393 commented 5 years ago

Try to set up 'DRIVER=pcov' as an Environment Variable and then start phpunit.

https://github.com/lukas9393/dockerfiles/blob/master/laravel-phpunit-pcov/Dockerfile

ohnotnow commented 5 years ago

Thanks for the reply - sadly it didn't make a difference though.

$ echo ${DRIVER}
pcov
$ php vendor/bin/phpunit --coverage-text --colors=never

PHPUnit 7.5.9 by Sebastian Bergmann and contributors.

Fatal error: Uncaught SebastianBergmann\CodeCoverage\RuntimeException: No code coverage driver available in /builds/ohffs/glasgow_projects/vendor/phpunit/php-code-coverage/src/CodeCoverage.php:908
krakjoe commented 5 years ago

pcov requires phpunit 8

On Fri, 26 Apr 2019, 14:17 ohnotnow, notifications@github.com wrote:

Thanks for the reply - sadly it didn't make a difference though.

$ echo ${DRIVER} pcov $ php vendor/bin/phpunit --coverage-text --colors=never

PHPUnit 7.5.9 by Sebastian Bergmann and contributors.

Fatal error: Uncaught SebastianBergmann\CodeCoverage\RuntimeException: No code coverage driver available in /builds/ohffs/glasgow_projects/vendor/phpunit/php-code-coverage/src/CodeCoverage.php:908

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/krakjoe/pcov/issues/13#issuecomment-487036455, or mute the thread https://github.com/notifications/unsubscribe-auth/AARB52R2H5ZMZSIKHUQLWILPSLXEXANCNFSM4HIUEJJQ .

ohnotnow commented 5 years ago

Oh, ffs! Now I remember thinking a few weeks ago 'Well, I'll hold off trying pcov for a bit' after reading that. Riiiiight up until today when I thought 'heh - it's Friday, I'll try that pcov thing!'.

Sorry - Friday brain fade!