leanphp / behat-code-coverage

Generate Code Coverage reports for Behat tests
BSD 2-Clause "Simplified" License
50 stars 23 forks source link

Not compatible with phpunit/php-code-coverage 6 #35

Closed yeroon closed 6 years ago

yeroon commented 6 years ago

The package is not compatible with phpunit/php-code-coverage 6:

 Symfony\Component\Debug\Exception\FatalErrorException  : Declaration of LeanPHP\Behat\CodeCoverage\Driver\Proxy::start($determineUnusedAndDead = true) must be compatible with SebastianBergmann\CodeCoverage\Driver\Driver::start(bool $determineUnusedAndDead = true): void

  at /Users/jeroen/Projects/kbhb/vendor/leanphp/behat-code-coverage/src/Driver/Proxy.php: 21
   Symfony\Component\Debug\Exception\FatalErrorException  : Declaration of LeanPHP\Behat\CodeCoverage\Driver\Proxy::start($determineUnusedAndDead = true) must be compatible with SebastianBergmann\CodeCoverage\Driver\Driver::start(bool $determineUnusedAndDead = true): void

  at /Users/jeroen/Projects/kbhb/vendor/leanphp/behat-code-coverage/src/Driver/Proxy.php: 21
  17:  * Proxy driver
  18:  *
  19:  * @author Anthon Pang <apang@softwaredevelopment.ca>
  20:  */
  21: class Proxy implements DriverInterface
  22: {
  23:     /**
  24:      * @var array
  25:      */
  26:     private $drivers = array();

  Exception trace:

  1   Symfony\Component\Debug\Exception\FatalErrorException::__construct()
      /Users/jeroen/Projects/kbhb/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php : 137

  2   Illuminate\Foundation\Bootstrap\HandleExceptions::fatalExceptionFromError()
      /Users/jeroen/Projects/kbhb/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php : 123

  Please use the argument -v to see more details.

   Whoops\Exception\ErrorException  : Declaration of LeanPHP\Behat\CodeCoverage\Driver\Proxy::start($determineUnusedAndDead = true) must be compatible with SebastianBergmann\CodeCoverage\Driver\Driver::start(bool $determineUnusedAndDead = true): void

  at /Users/jeroen/Projects/kbhb/vendor/leanphp/behat-code-coverage/src/Driver/Proxy.php: 21
  17:  * Proxy driver
  18:  *
  19:  * @author Anthon Pang <apang@softwaredevelopment.ca>
  20:  */
  21: class Proxy implements DriverInterface
  22: {
  23:     /**
  24:      * @var array
  25:      */
  26:     private $drivers = array();

  Exception trace:

  1   ()
      /Users/jeroen/Projects/kbhb/vendor/composer/ClassLoader.php : 444

  2   Composer\Autoload\includeFile()
      /Users/jeroen/Projects/kbhb/vendor/composer/ClassLoader.php : 322

installed versions:

php 7.1.8 leanphp/behat-code-coverage 3.3.0 phpunit/php-code-coverage 6.0.4 phpunit/phpunit 7.1.5

ek9 commented 6 years ago

Thank you for the report, will push a fix for this later today.

ek9 commented 6 years ago

Due to semantic versioning and not being able to support both php-code-coverage 5.0 and 6.0 at the same time, I have issued multiple updates:

Please make sure to update to version ^3.4 of this extension and let me know if there are still any problems.

Closing

yeroon commented 6 years ago

@ek9 Thanks for the quick response! However, I run into the following error:

In ContainerBuilder.php line 1608:

  [ErrorException]                                                                                                                                                                       
  call_user_func_array() expects parameter 1 to be a valid callback, class 'SebastianBergmann\CodeCoverage\CodeCoverage' does not have a method 'setMapTestClassNameToCoveredClassName'  

Exception trace:
 Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at n/a:n/a
 call_user_func_array() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1608
 Symfony\Component\DependencyInjection\ContainerBuilder->callMethod() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1180
 Symfony\Component\DependencyInjection\ContainerBuilder->createService() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:623
 Symfony\Component\DependencyInjection\ContainerBuilder->doGet() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1264
 Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1221
 Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1134
 Symfony\Component\DependencyInjection\ContainerBuilder->createService() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:623
 Symfony\Component\DependencyInjection\ContainerBuilder->doGet() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1264
 Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1221
 Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1608
 Symfony\Component\DependencyInjection\ContainerBuilder->callMethod() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1180
 Symfony\Component\DependencyInjection\ContainerBuilder->createService() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:623
 Symfony\Component\DependencyInjection\ContainerBuilder->doGet() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1264
 Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1221
 Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1134
 Symfony\Component\DependencyInjection\ContainerBuilder->createService() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:623
 Symfony\Component\DependencyInjection\ContainerBuilder->doGet() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1264
 Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1221
 Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1221
 Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:1134
 Symfony\Component\DependencyInjection\ContainerBuilder->createService() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:623
 Symfony\Component\DependencyInjection\ContainerBuilder->doGet() at /Users/jeroen/Projects/kbhb/vendor/symfony/dependency-injection/ContainerBuilder.php:588
 Symfony\Component\DependencyInjection\ContainerBuilder->get() at /Users/jeroen/Projects/kbhb/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php:161
 Behat\Testwork\Cli\Application->createCommand() at /Users/jeroen/Projects/kbhb/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php:122
 Behat\Testwork\Cli\Application->doRun() at /Users/jeroen/Projects/kbhb/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /Users/jeroen/Projects/kbhb/vendor/behat/behat/bin/behat:34

Using the versions:

php 7.1.8 leanphp/behat-code-coverage 3.4.0 phpunit/php-code-coverage 6.0.4 phpunit/phpunit 7.1.5

I am able to work around this problem by downgrading phpunit to 6.x.

ek9 commented 6 years ago

Reopening. It seems setMapTestClassNameToCoveredClassName function was finally dropped in v6 (it was deprecated already during v5). An oversight on my part to not remove dependency on it.

ek9 commented 6 years ago

v3.4.1 is now released with this issue patched in. I did a proper test and it seems to be working correctly now on my end. Let me know otherwise. Closing.