sebastianbergmann / phpunit

The PHP Unit Testing framework.
https://phpunit.de/
BSD 3-Clause "New" or "Revised" License
19.7k stars 2.2k forks source link

forceCoversAnnotation XML configuration attribute has no matching CLI runner attribute #4869

Closed andrewnicols closed 2 years ago

andrewnicols commented 2 years ago
Q A
PHPUnit version 9.5.2
PHP version 7.4.27
Installation Method Composer

Composer info | sort

behat/behat                        v3.8.1             Scenario-oriented BDD framework for PHP
behat/gherkin                      v4.9.0             Gherkin DSL parser for PHP
behat/mink                         v1.9.0             Browser controller/emulator abstraction for PHP
behat/mink-browserkit-driver       v1.4.1             Symfony2 BrowserKit driver for Mink framework
behat/mink-goutte-driver           v1.3.0             Goutte driver for Mink framework
behat/transliterator               v1.3.0             String transliterator
doctrine/instantiator              1.4.0              A small, lightweight utility to instantiate objects in PHP without invoking thei...
fabpot/goutte                      v3.3.1             A simple PHP Web Scraper
friends-of-behat/mink-extension    dev-master 586ffcc Mink extension for Behat
guzzlehttp/guzzle                  6.5.5              Guzzle is a PHP HTTP client library
guzzlehttp/promises                1.5.1              Guzzle promises library
guzzlehttp/psr7                    1.8.3              PSR-7 message implementation that also provides common utility methods
mikey179/vfsstream                 v1.6.10            Virtual file system to mock the real file system in unit tests.
moodlehq/behat-extension           v3.400.5           Moodle behat extension
myclabs/deep-copy                  1.10.2             Create deep copies (clones) of your objects
nikic/php-parser                   v4.13.2            A PHP parser written in PHP
oleg-andreyev/mink-phpwebdriver    v1.0.1             MinkPhpWebDriver driver for Mink framework
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
php-webdriver/webdriver            1.12.0             A PHP client for Selenium WebDriver. Previously facebook/webdriver.
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...
phpdocumentor/type-resolver        1.5.1              A PSR-5 based resolver of Class names, Types and Structural Element Names
phpspec/prophecy                   v1.15.0            Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage          9.2.10             Library that provides collection, processing, and rendering functionality for PH...
phpunit/php-file-iterator          3.0.6              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/container                      1.1.1              Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher               1.0.0              Standard interfaces for event handling.
psr/http-message                   1.0.1              Common interface for HTTP messages
ralouphie/getallheaders            3.0.3              A polyfill for getallheaders.
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.4              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/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
symfony/browser-kit                v4.4.27            Simulates the behavior of a web browser, allowing you to make requests, click on...
symfony/config                     v5.4.0             Helps you find, load, combine, autofill and validate configuration values of any...
symfony/console                    v5.4.1             Eases the creation of beautiful and testable command line interfaces
symfony/css-selector               v5.4.0             Converts CSS selectors to XPath expressions
symfony/dependency-injection       v5.4.1             Allows you to standardize and centralize the way objects are constructed in your...
symfony/deprecation-contracts      v2.5.0             A generic function and convention to trigger deprecation notices
symfony/dom-crawler                v4.4.30            Eases DOM navigation for HTML and XML documents
symfony/event-dispatcher           v5.4.0             Provides tools that allow your application components to communicate with each o...
symfony/event-dispatcher-contracts v2.5.0             Generic abstractions related to dispatching event
symfony/filesystem                 v5.4.0             Provides basic utilities for the filesystem
symfony/polyfill-ctype             v1.23.0            Symfony polyfill for ctype functions
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.4.0             Executes commands in sub-processes
symfony/service-contracts          v2.5.0             Generic abstractions related to writing services
symfony/string                     v5.4.0             Provides an object-oriented API to strings and deals with bytes, UTF-8 code poin...
symfony/translation                v5.4.1             Provides tools to internationalize your application
symfony/translation-contracts      v2.5.0             Generic abstractions related to translation
symfony/yaml                       v5.4.0             Loads and dumps YAML files
theseer/tokenizer                  1.2.1              A small library for converting tokenized PHP source code into XML and potentiall...
webmozart/assert                   1.10.0             Assertions to validate method input/output with nice error messages.

Summary

The forceCoversAnnotation XML configuration attribute does not have a matching Command-Line Test Runner parameter.

Current behavior

Unable to specify forceCoversAnnotation via the CLI runner.

How to reproduce

View phpunti help

Expected behavior

Ability to set the forceCoversAnnotation for a single run without requiring reconfiguration of the suite.

Note: This behaviour is desirable for older codebases which are trying to improve coverage. We need to continue running most of our runs without forceCoversAnnotation and with failOnRisky, but for a small subset of runs we want to require coverage and not fail the suite where it is not provided so that we can report the coverage and gradually increase the explicitly covered code. At the moment, this can only be achived by modifying the configuration file as forceCoversAnnotation is not available as a CLI argument, and fail-on-risky can only be set to true via the CLI runner.

13rAXwNNnaAuCJA3z1REfJbJNMwgK4LBTC commented 2 years ago

blockchainlab9@gmail.com

13rAXwNNnaAuCJA3z1REfJbJNMwgK4LBTC commented 2 years ago

blockchainlab9@gmail.com http://creativecommons.org/.

13rAXwNNnaAuCJA3z1REfJbJNMwgK4LBTC commented 2 years ago

phpunit/phpunit 9.5.10 The PHP Unit Testing framework

sebastianbergmann commented 2 years ago

Not everything that can be configured in XML needs to be configuration using CLI options and vice versa.