Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

416
Visualizações
PHPUnit can't generate code coverage when running tests in separate processes

I have a problem that I could not find the solution on Google. When I run my unit tests with PHPUnit and Xdebug, I would like to do a code coverage.

However, when I do that, I get this error:

PHPUnit\Framework\Exception: Fatal error: Uncaught SebastianBergmann\CodeCoverage\NoCodeCoverageDriverAvailableException: No code coverage driver available in /Users/theobenoit/Desktop/Antipode.nosync/Sites/wp-framework-core/vendor/phpunit/php-code-coverage/src/Driver/Selector.php:53
   ├ Stack trace:
   ├ #0 Standard input code(43): SebastianBergmann\CodeCoverage\Driver\Selector->forLineCoverage(Object(SebastianBergmann\CodeCoverage\Filter))
   ├ #1 Standard input code(123): __phpunit_run_isolated_test()
   ├ #2 {main}
   ├   thrown in /Users/theobenoit/Desktop/Antipode.nosync/Sites/wp-framework-core/vendor/phpunit/php-code-coverage/src/Driver/Selector.php on line 53

I realized that this is because in some of my tests there is this at the top:

/**
 * @runTestsInSeparateProcesses
 * @preserveGlobalState disabled
 */

When I remove @runTestsInSeparateProcesses everything works fine, but there are problems because I mock functions.

If anyone has ever had this problem.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

This is likely because with runTestsInSeparateProcesses, PHPUnit starts a new PHP process for every test. And it seems that it does that without Xdebug loaded.

The PHP that is started for each test needs to be the same as the one that you originally started PHPUnit with. Perhaps there is a different PHP binary first in the PATH?

If that is the case, the way to solve it is to make sure the "right" PHP is first in the PATH.

over 4 years ago · Santiago Trujillo Relatório

0

I could fix the very same problem by disabling force break when there are no mappings, a setting in the IDE under xdebug-settings.

See: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360009770579-Docker-debug-problem-Remote-file-path-home-www-Standard-input-code-is-not-mapped-to-any-file-path-in-project-

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda