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

QA/Tests: various code coverage tweaks #331

Merged
merged 3 commits into from
Jun 29, 2022

Commits on Jun 29, 2022

  1. GH Actions/coverage: add extra (debug) step

    While the feedback shown in the `setup-php` step is awesome, it doesn't show the version of Xdebug used when running code coverage, while, in case of issues, the version number of Xdebug is crucial to know.
    
    This extra step allows for that information to always be available.
    
    I've only added the step to the code coverage job though as that's the only one for which the Xdebug version is relevant.
    jrfnl committed Jun 29, 2022
    Configuration menu
    Copy the full SHA
    d8263d2 View commit details
    Browse the repository at this point in the history
  2. PHPUnit config: isolate a number of tests from the main test suite

    The functions being tested in these three test classes all use function local `static` variables for optimization.
    
    Having the function local `static` variable will often prevent code coverage from being recorded correctly for the code as the code for setting the static will only be run when the function is first called, which may not be in the dedicated test for the function, so it makes code coverage recording highly dependant on the order in which tests are run.
    
    In these three cases, I do believe the function local `static` variable is justified (for the time being, benchmarking should be able to determine for sure at some point in the future).
    
    To still prevent missed lines in the code coverage reports, I'm moving the tests for these three functions into a separate test suite, which will run first.
    This should ensure the code which sets the static will be run first when the dedicated tests for these methods are run and should allow the correct registration of code coverage for this code.
    
    Mind: if at some point the `executionOrder` configuration would be added to the config/enabled, it needs to be verified how that behaves in combination with multiple test suites. But that's for later.
    
    Ref: sebastianbergmann/php-code-coverage#913
    jrfnl committed Jun 29, 2022
    Configuration menu
    Copy the full SHA
    047929b View commit details
    Browse the repository at this point in the history
  3. Tests: add select @codeCoverageIgnore annotations

    ... for code which is only in place as defensive coding, but shouldn't be reachable under normal circumstances.
    jrfnl committed Jun 29, 2022
    Configuration menu
    Copy the full SHA
    2ed664c View commit details
    Browse the repository at this point in the history