sebastianbergmann / php-code-coverage

Library that provides collection, processing, and rendering functionality for PHP code coverage information.
BSD 3-Clause "New" or "Revised" License
8.78k stars 373 forks source link

Code Coverage is not calculated for complete source folder #873

Closed renepardon closed 2 years ago

renepardon commented 2 years ago
Q A
PHPUnit version 9.5.10
PHP version 8.0.11
Installation Method Composer
Driver pcov

Summary

I execute PHPUnit Unit/Feature tests within the scope of my laravel application based on the following composer script:

php artisan config:clear ; ./vendor/bin/phing init ; XDEBUG_MODE=coverage php artisan test --parallel --colors ; php artisan config: clear

The config:clear is to read proper .env.testing file and deleting the config cache afterwards. phing init just creates the required directories. artisan test --parallel executes tests in parallel. (https://github.com/nunomaduro/collision/blob/stable/src/Adapters/Laravel/Commands/TestCommand.php)

Current behavior

No code coverage is being generated for Modules/ folder but corresponding tests are executed. (At all 218) Screenshot_20211021_155520

How to reproduce

See summary.

Expected behavior

Code coverage should be calculated for all folders defined in:

coverage > include > directory

Composer packages

```bash adldap2/adldap2 v10.3.3 A PHP LDAP Package for humans. asm89/stack-cors v2.0.3 Cross-origin resource sharing library and stack middleware aws/aws-crt-php v1.0.2 AWS Common Runtime for PHP aws/aws-sdk-php 3.198.8 AWS SDK for PHP - Use Amazon Web Services in your PHP project barryvdh/laravel-ide-helper v2.10.0 Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-co... barryvdh/reflection-docblock v2.0.6 bensampo/laravel-enum v3.4.2 Simple, extensible and powerful enumeration implementation for Laravel. brainmaestro/composer-git-hooks v2.8.5 Easily manage git hooks in your composer config brianium/paratest v6.3.1 Parallel testing for PHP brick/math 0.9.3 Arbitrary-precision arithmetic library composer/ca-bundle 1.2.11 Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA ... composer/composer 2.1.9 Composer helps you declare, manage and install dependencies of PHP projects. It ensures ... composer/metadata-minifier 1.0.0 Small utility library that handles metadata minification and expansion. composer/package-versions-deprecated 1.11.99.4 Composer plugin that provides efficient querying for installed package versions (no runt... composer/semver 3.2.5 Semver library that offers utilities, version constraint parsing and validation. composer/spdx-licenses 1.5.5 SPDX licenses list and validation library. composer/xdebug-handler 2.0.2 Restarts a process without Xdebug. defuse/php-encryption v2.3.1 Secure PHP Encryption Library doctrine/cache 2.1.1 PHP Doctrine Cache library is a popular cache implementation that supports many differen... doctrine/dbal 3.1.3 Powerful PHP database abstraction layer (DBAL) with many features for database schema in... doctrine/deprecations v0.5.3 A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options t... doctrine/event-manager 1.1.1 The Doctrine Event Manager is a simple PHP event system that was built to be used with t... doctrine/inflector 2.0.3 PHP Doctrine Inflector is a small library that can perform string manipulations with reg... doctrine/instantiator 1.4.0 A small, lightweight utility to instantiate objects in PHP without invoking their constr... doctrine/lexer 1.2.1 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers. dragonmantank/cron-expression v3.1.0 CRON for PHP: Calculate the next or previous run date and determine if a CRON expression... egulias/email-validator 2.1.25 A library for validating emails against several RFCs facade/flare-client-php 1.9.1 Send PHP errors to Flare facade/ignition 2.15.0 A beautiful error page for Laravel applications. facade/ignition-contracts 1.0.2 Solution contracts for Ignition fideloper/proxy 4.4.1 Set trusted proxies for Laravel filp/whoops 2.14.4 php error handling for cool kids firebase/php-jwt v5.4.0 A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to th... fruitcake/laravel-cors v2.0.4 Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application fzaninotto/faker dev-master 5ffe7db Faker is a PHP library that generates fake data for you. graham-campbell/manager v4.6.0 Manager Provides Some Manager Functionality For Laravel graham-campbell/result-type v1.0.3 An Implementation Of The Result Type graylog2/gelf-php 1.7.1 A php implementation to send log-messages to a GELF compatible backend like Graylog2. guzzlehttp/guzzle 7.4.0 Guzzle is a PHP HTTP client library guzzlehttp/promises 1.5.0 Guzzle promises library guzzlehttp/psr7 1.8.3 PSR-7 message implementation that also provides common utility methods hamcrest/hamcrest-php v2.0.1 This is the PHP port of Hamcrest Matchers hanneskod/classtools 1.2.1 Find, extract and process classes from file system hashids/hashids 4.1.0 Generate short, unique, non-sequential ids (like YouTube and Bitly) from numbers haydenpierce/class-finder 0.4.3 A library that can provide of a list of classes in a given namespace hedii/laravel-gelf-logger 6.0.0 A Laravel package to send logs to a gelf compatible backend like graylog icanhazstring/composer-unused 0.7.7 Show unused packages by scanning your code intervention/image 2.7.0 Image handling and manipulation library with support for Laravel integration jawira/plantuml-client v1.0.1 Convert PlantUML diagrams into images. jawira/plantuml-encoding v1.0.8 PlantUML text encoding functions joshbrw/laravel-module-installer v1.0.2 justinrainbow/json-schema 5.2.11 A library to validate a json schema. kalnoy/nestedset v5.0.5 Nested Set Model for Laravel 5.7 and up laminas/laminas-code 3.5.1 Extensions to the PHP Reflection API, static code scanning, and code generation laminas/laminas-eventmanager 3.4.0 Trigger and listen to events within a PHP application laminas/laminas-zendframework-bridge 1.4.0 Alias legacy ZF class names to Laminas Project equivalents. laragraph/utils v1.0.0 Utilities for using GraphQL with Laravel laravel/framework v8.42.1 The Laravel Framework. laravel/legacy-factories v1.1.1 The legacy version of the Laravel Eloquent factories. laravel/passport v10.1.4 Laravel Passport provides OAuth2 server support to Laravel. laravel/scout v8.6.1 Laravel Scout provides a driver based solution to searching your Eloquent models. laravel/tinker v2.6.2 Powerful REPL for the Laravel framework. laravel/ui v3.3.0 Laravel UI utilities and presets. lcobucci/clock 2.0.0 Yet another clock abstraction lcobucci/jwt 4.1.5 A simple library to work with JSON Web Token and JSON Web Signature league/commonmark 1.6.6 Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and Githu... league/event 2.2.0 Event package league/flysystem 1.1.5 Filesystem abstraction: Many filesystems, one API. league/flysystem-aws-s3-v3 1.0.29 Flysystem adapter for the AWS S3 SDK v3.x league/flysystem-cached-adapter 1.1.0 An adapter decorator to enable meta-data caching. league/glide 1.7.0 Wonderfully easy on-demand image manipulation library with an HTTP based API. league/glide-laravel 1.0.0 Glide adapter for Laravel league/glide-symfony 1.0.4 Glide adapter for Symfony league/mime-type-detection 1.8.0 Mime-type detection for Flysystem league/oauth2-server 8.3.3 A lightweight and powerful OAuth 2.0 authorization and resource server library with supp... league/uri 6.5.0 URI manipulation library league/uri-components 2.4.0 URI components manipulation library league/uri-interfaces 2.3.0 Common interface for URI representation mehr-als-nix/parallel v1.0.0 This package is a port of PhpDumentor/Parallel mll-lab/graphql-php-scalars v3.1.0 A collection of custom scalar types for usage with https://github.com/webonyx/graphql-php mll-lab/laravel-graphql-playground v2.5.0 Easily integrate GraphQL Playground into your Laravel project mockery/mockery 1.4.4 Mockery is a simple yet flexible PHP mock object framework monolog/monolog 2.3.5 Sends your logs to files, sockets, inboxes, databases and various web services mtdowling/jmespath.php 2.6.1 Declaratively specify how to extract elements from a JSON document myclabs/deep-copy 1.10.2 Create deep copies (clones) of your objects nesbot/carbon 2.53.1 An API extension for DateTime that supports 281 different languages. nikic/php-parser v4.13.0 A PHP parser written in PHP nunomaduro/collision v5.10.0 Cli error handling for console/command-line PHP applications. nunomaduro/larastan v0.7.13 Larastan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for ... nuwave/lighthouse v5.24.0 A framework for serving GraphQL from Laravel nwidart/laravel-modules 7.3.0 Laravel Module management nyholm/psr7 1.4.1 A fast PHP7 implementation of PSR-7 opis/closure 3.6.2 A library that can be used to serialize closures (anonymous functions) and arbitrary obj... paragonie/constant_time_encoding v2.4.0 Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16) paragonie/random_compat v9.99.100 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7 pdepend/pdepend 2.10.1 Official version of pdepend to be handled with Composer pear/archive_tar 1.4.14 Tar file management class with compression support (gzip, bzip2, lzma2) pear/console_getopt v1.4.3 More info available on: http://pear.php.net/package/Console_Getopt pear/pear-core-minimal v1.10.11 Minimal set of PEAR core files to be used as composer dependency pear/pear_exception v1.0.2 The PEAR Exception base class. pear/versioncontrol_git dev-master 2fcd233 VersionControl_Git is a library that provides OO interface to handle Git repository. pear/versioncontrol_svn 0.7.0 More info available on: http://pear.php.net/package/VersionControl_SVN phar-io/manifest 2.0.3 Component for reading phar.io manifest information from a PHP Archive (PHAR) phar-io/version 3.1.0 Library for handling version information and constraints phing/phing 3.0.0-RC3 PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant. phing/phing-composer-configurator dev-master a151e18 PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant. phing/task-analyzers dev-main c5a6c66 Tasks for code analysis. phing/task-apigen dev-master df34b0d Task for ApiGen, a tool for creating professional API documentation from PHP source code. phing/task-archives dev-main dfc47ea Archive related phing tasks and types. phing/task-aws dev-main c3c8195 AWS related tasks. phing/task-coverage dev-master e68f3ba coverage database tasks which can be used to gather code coverage information for unit t... phing/task-dbdeploy dev-main 36519d6 phing/task-ftpdeploy dev-master 4837b11 Deploys a set of files to a remote FTP server. phing/task-git dev-main f928d2e Git related phing tasks. phing/task-hg dev-main 1b09e6d Mercurial related phing tasks. phing/task-http dev-main fd5e1d9 HTTP related tasks. phing/task-inifile dev-main 54b9e2c Tasks related to ini files. phing/task-ioncube dev-master ce92e5b The Ioncube tasks executes ionCube commands. phing/task-jshint dev-master 782d405 Checks the JavaScript code using JSHint. phing/task-jsmin dev-master 437d879 Task to minify javascript files. phing/task-liquibase dev-master 91cfa93 The LiquibaseTask is a generic task for liquibase commands that don't require extra comm... phing/task-phkpackage dev-master f753840 This task runs PHK_Creator.phk to build PHK-package. phing/task-phpdoc dev-master 87db308 This task runs phpDocumentor 2, a API documentation tool. This project is the result of ... phing/task-phpunit dev-main 8c5e2fd PHPUnit related tasks. phing/task-sass dev-main 13d5209 SassTask. phing/task-smarty dev-master ad36b52 A task for generating output by using Smarty. phing/task-ssh dev-master 28fabc2 Execute commands on a remote host using ssh. phing/task-svn dev-master 69c3014 Subversion related phing tasks. phing/task-visualizer dev-main 3abb57a VisualizerTask creates diagrams using buildfiles, these diagrams represents calls and de... phing/task-zendcodeanalyser dev-master c794fd8 The ZendCodeAnalyzerTask analyze PHP source files using the Zend Code Analyzer tool that... phing/task-zendserverdevelopmenttools dev-master a5f8b0e Zend Server Development Tools. phpdocumentor/reflection-common 2.2.0 Common reflection classes used by phpdocumentor to reflect the code structure phpdocumentor/reflection-docblock 5.3.0 With this component, a library can provide support for annotations via DocBlocks or othe... phpdocumentor/type-resolver 1.5.1 A PSR-5 based resolver of Class names, Types and Structural Element Names php-http/message-factory v1.0.2 Factory interfaces for PSR-7 HTTP Message phploc/phploc 7.0.2 A tool for quickly measuring the size of a PHP project. phpmd/phpmd 2.10.2 PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well kn... phpoption/phpoption 1.8.0 Option Type for PHP phpseclib/phpseclib 3.0.10 PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.... phpspec/prophecy 1.14.0 Highly opinionated mocking framework for PHP 5.3+ phpstan/phpstan 0.12.99 PHPStan - PHP Static Analysis Tool phpunit/php-code-coverage 9.2.7 Library that provides collection, processing, and rendering functionality for PHP code c... phpunit/php-file-iterator 3.0.5 FilterIterator implementation that filters files based on a list of suffixes. phpunit/php-invoker 3.1.1 Invoke callables with a timeout phpunit/php-text-template 2.0.4 Simple template engine. phpunit/php-timer 5.0.3 Utility class for timing phpunit/phpunit 9.5.10 The PHP Unit Testing framework. psr/cache 1.0.1 Common interface for caching libraries psr/container 1.1.1 Common Container Interface (PHP FIG PSR-11) psr/event-dispatcher 1.0.0 Standard interfaces for event handling. psr/http-client 1.0.1 Common interface for HTTP clients psr/http-factory 1.0.1 Common interfaces for PSR-7 HTTP message factories psr/http-message 1.0.1 Common interface for HTTP messages psr/log 1.1.4 Common interface for logging libraries psr/simple-cache 1.0.1 Common interfaces for simple caching psy/psysh v0.10.9 An interactive shell for modern PHP. ralouphie/getallheaders 3.0.3 A polyfill for getallheaders. ramsey/collection 1.2.2 A PHP library for representing and manipulating collections. ramsey/uuid 4.2.3 A PHP library for generating and working with universally unique identifiers (UUIDs). react/promise v2.8.0 A lightweight implementation of CommonJS Promises/A for PHP renepardon/laravel-seeder v8.0.2 Versioned, environment-based Seeders in Laravel sebastian/cli-parser 1.0.1 Library for parsing CLI options sebastian/code-unit 1.0.8 Collection of value objects that represent the PHP code units sebastian/code-unit-reverse-lookup 2.0.3 Looks up which function or method a line of code belongs to sebastian/comparator 4.0.6 Provides the functionality to compare PHP values for equality sebastian/complexity 2.0.2 Library for calculating the complexity of PHP code units sebastian/diff 4.0.4 Diff implementation sebastian/environment 5.1.3 Provides functionality to handle HHVM/PHP environments sebastian/exporter 4.0.3 Provides the functionality to export PHP variables for visualization sebastian/global-state 5.0.3 Snapshotting of global state sebastian/lines-of-code 1.0.3 Library for counting the lines of code in PHP source code sebastian/object-enumerator 4.0.4 Traverses array structures and object graphs to enumerate all referenced objects sebastian/object-reflector 2.0.4 Allows reflection of object attributes, including inherited and non-public ones sebastian/phpcpd 6.0.3 Copy/Paste Detector (CPD) for PHP code. sebastian/recursion-context 4.0.4 Provides functionality to recursively process PHP variables sebastian/resource-operations 3.0.3 Provides a list of PHP built-in functions that operate on resources sebastian/type 2.3.4 Collection of value objects that represent the types of the PHP type system sebastian/version 3.0.2 Library that helps with managing the version number of Git-hosted PHP projects seld/jsonlint 1.8.3 JSON Linter seld/phar-utils 1.1.2 PHAR file format utilities, for when PHP phars you up siad007/versioncontrol_hg v1.0.3 VersionControl_HG is a library that provides an OO interface to handle Mercurial reposit... spatie/data-transfer-object 3.7.2 Data transfer objects with batteries included spatie/laravel-activitylog 3.17.0 A very simple activity logger to monitor the users of your website or application spatie/laravel-permission 3.18.0 Permission handling for Laravel 5.8 and up spatie/laravel-settings 2.1.12 Store your application settings spatie/laravel-translation-loader 2.7.0 Store your language lines in the database, yaml or other sources spatie/regex 1.4.2 A sane interface for php's built in preg_* functions spatie/temporary-directory 2.0.0 Easily create, use and destroy temporary directories spatie/url-signer 1.2.2 Generate a url with an expiration date and signature to prevent unauthorized access squizlabs/php_codesniffer 3.6.1 PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defi... stancl/jobpipeline v1.5.0 Turn any series of jobs into Laravel listeners. stancl/tenancy v3.4.4 Automatic multi-tenancy for your Laravel application. stancl/virtualcolumn v1.1.0 Eloquent virtual column. swiftmailer/swiftmailer v6.3.0 Swiftmailer, free feature-rich PHP mailer symfony/config v5.3.4 Helps you find, load, combine, autofill and validate configuration values of any kind symfony/console v5.3.7 Eases the creation of beautiful and testable command line interfaces symfony/css-selector v5.3.4 Converts CSS selectors to XPath expressions symfony/dependency-injection v5.3.8 Allows you to standardize and centralize the way objects are constructed in your applica... symfony/deprecation-contracts v2.4.0 A generic function and convention to trigger deprecation notices symfony/error-handler v5.3.7 Provides tools to manage errors and ease debugging PHP code symfony/event-dispatcher-contracts v2.4.0 Generic abstractions related to dispatching event symfony/event-dispatcher v5.3.7 Provides tools that allow your application components to communicate with each other by ... symfony/filesystem v5.3.4 Provides basic utilities for the filesystem symfony/finder v5.3.7 Finds files and directories via an intuitive fluent interface symfony/http-client-contracts v2.4.0 Generic abstractions related to HTTP clients symfony/http-foundation v5.3.7 Defines an object-oriented layer for the HTTP specification symfony/http-kernel v5.3.9 Provides a structured process for converting a Request into a Response symfony/mime v5.3.8 Allows manipulating MIME messages symfony/polyfill-ctype v1.23.0 Symfony polyfill for ctype functions symfony/polyfill-iconv v1.23.0 Symfony polyfill for the Iconv extension symfony/polyfill-intl-grapheme v1.23.1 Symfony polyfill for intl's grapheme_* functions symfony/polyfill-intl-idn v1.23.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer v1.23.0 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring v1.23.1 Symfony polyfill for the Mbstring extension symfony/polyfill-php72 v1.23.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions symfony/polyfill-php73 v1.23.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions symfony/polyfill-php80 v1.23.1 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions symfony/polyfill-php81 v1.23.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions symfony/process v5.3.7 Executes commands in sub-processes symfony/psr-http-message-bridge v2.1.1 PSR HTTP message bridge symfony/routing v5.3.7 Maps an HTTP request to a set of configuration variables symfony/service-contracts v2.4.0 Generic abstractions related to writing services symfony/string v5.3.7 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and g... symfony/translation-contracts v2.4.0 Generic abstractions related to translation symfony/translation v5.3.9 Provides tools to internationalize your application symfony/var-dumper v5.3.8 Provides mechanisms for walking through any arbitrary PHP variable symfony/yaml v5.3.6 Loads and dumps YAML files thecodingmachine/safe v1.3.3 PHP core functions that throw exceptions instead of returning FALSE on error theseer/tokenizer 1.2.1 A small library for converting tokenized PHP source code into XML and potentially other ... tightenco/collect v8.34.0 Collect - Illuminate Collections as a separate package. tijsverkoyen/css-to-inline-styles 2.2.3 CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-page... vinkla/hashids 9.1.0 A Hashids bridge for Laravel vlucas/phpdotenv v5.3.1 Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagica... voku/portable-ascii 1.5.6 Portable ASCII library - performance optimized (ascii) string functions for php. webmozart/assert 1.10.0 Assertions to validate method input/output with nice error messages. webonyx/graphql-php v14.9.0 A PHP port of GraphQL reference implementation ```

phpunit.xml

This is the PHPUnit XML configuration I use https://gist.github.com/renepardon/2d926cc091c1dc84eddc927d54df5d87 Filter is no longer available in PHPUnit 9. Therefore commented.

kubawerlos commented 2 years ago

From https://github.com/krakjoe/pcov/tree/v1.0.9#notes:

When pcov.directory is left unset, PCOV will attempt to find src, lib or, app in the current working directory, in that order; If none are found the current directory will be used, which may waste resources storing coverage information for the test suite.

So you have to set pcov.directory or rename app to something else.

renepardon commented 2 years ago

@kubawerlos amazing. Thanks! I set it within /etc/php/8.0/cli/conf.d/20-pcov.ini as the absolute path to my application. So I just need to find a way to provide it as PHP cli parameter to the artisan command. Thank you!