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

XML Configuration File Migrator does not remove cacheDirectory attribute from <coverage> element when migrating from PHPUnit 11.1 to PHPUnit 11.2 #5859

Closed
knallcharge opened this issue Jun 10, 2024 · 2 comments
Assignees
Labels
feature/configuration/xml type/bug Something is broken version/11 Something affects PHPUnit 11

Comments

@knallcharge
Copy link

Q A
PHPUnit version 11.2.0
PHP version 8.3.8
Installation Method Composer

Summary

After updating from PHPUnit 11.1 to 11.2 I get the error "Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!"

Using "--migrate-configuration" will change nothing in my phpunit.xml.dist (except some whitespace) and will not resolve the issue, the error stays.

Current behavior

I can't get rid of the message "Your XML configuration validates against a deprecated schema.".

How to reproduce

Use this phpunit.xml.dist and run PHPUnit:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" colors="true" bootstrap="tests/bootstrap.php" executionOrder="random" resolveDependencies="true" cacheDirectory="var/.phpunit.cache" beStrictAboutCoverageMetadata="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd">
  <php>
    <ini name="display_errors" value="1"/>
    <ini name="error_reporting" value="-1"/>
    <server name="APP_ENV" value="test" force="true"/>
    <server name="SHELL_VERBOSITY" value="-1"/>
    <server name="KERNEL_CLASS" value="App\Kernel"/>
  </php>
  <testsuites>
    <testsuite name="Project Test Suite">
      <directory>tests</directory>
    </testsuite>
  </testsuites>
  <coverage includeUncoveredFiles="true" ignoreDeprecatedCodeUnits="true" cacheDirectory="var/.coverage-cache">
    <report>
      <crap4j outputFile="build/logs/crap4j.xml" threshold="50"/>
      <html outputDirectory="build/artifacts/coverage" lowUpperBound="35" highLowerBound="70"/>
      <xml outputDirectory="build/artifacts/coverage-xml"/>
    </report>
  </coverage>
  <logging>
    <junit outputFile="build/artifacts/coverage-xml/junit.xml"/>
  </logging>
  <extensions>
    <bootstrap class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension"/>
  </extensions>
  <source>
    <include>
      <directory suffix=".php">src</directory>
    </include>
    <exclude>
      <directory suffix=".php">src/generated</directory>
      <file>src/autoload.php</file>
    </exclude>
  </source>
</phpunit>

This is the output of "composer info":


cbschuld/browser.php                           1.9.6              A PHP Class to detect a user's Browser.  This encapsulation provides a breakdown of the brows...
colinodell/json5                               3.0.0              UTF-8 compatible JSON5 parser for PHP
composer/ca-bundle                             1.5.0              Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.
composer/pcre                                  3.1.4              PCRE wrapping library that offers type-safe preg_* replacements.
composer/xdebug-handler                        3.0.5              Restarts a process without Xdebug.
dama/doctrine-test-bundle                      8.2.0              Symfony bundle to isolate doctrine database tests and improve test performance
dealerdirect/phpcodesniffer-composer-installer 1.0.0              PHP_CodeSniffer Standards Composer Installer Plugin
doctrine/cache                                 2.2.0              PHP Doctrine Cache library is a popular cache implementation that supports many different dri...
doctrine/collections                           2.2.2              PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/dbal                                  3.8.4              Powerful PHP database abstraction layer (DBAL) with many features for database schema introsp...
doctrine/deprecations                          1.1.3              A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to dis...
doctrine/doctrine-bundle                       2.12.0             Symfony DoctrineBundle
doctrine/event-manager                         2.0.1              The Doctrine Event Manager is a simple PHP event system that was built to be used with the va...
doctrine/inflector                             2.0.10             PHP Doctrine Inflector is a small library that can perform string manipulations with regard t...
doctrine/instantiator                          2.0.0              A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                                 3.0.1              PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm                                   3.2.0              Object-Relational-Mapper for PHP
doctrine/persistence                           3.3.2              The Doctrine Persistence project is a set of shared interfaces and functionality that the dif...
doctrine/sql-formatter                         1.4.0              a PHP SQL highlighting library
easycorp/easyadmin-bundle                      4.10.2             Admin generator for Symfony applications
egulias/email-validator                        4.0.2              A library for validating emails against several RFCs
ekino/phpstan-banned-code                      1.0.0              Detected banned code using PHPStan
fidry/cpu-core-counter                         1.1.0              Tiny utility to get the number of CPU cores.
infection/abstract-testframework-adapter       0.5.0              Abstract Test Framework Adapter for Infection
infection/extension-installer                  0.1.2              Infection Extension Installer
infection/include-interceptor                  0.2.5              Stream Wrapper: Include Interceptor. Allows to replace included (autoloaded) file with anothe...
infection/infection                            0.29.4             Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to...
infection/mutator                              0.4.0              Mutator interface to implement custom mutators (mutation operators) for Infection
jawira/db-draw                                 1.6.0              ­ƒôÉ Takes a DoctrineORM connection and generates a database diagram in .puml format
jawira/doctrine-diagram-bundle                 0.8.0              ­ƒôÉ Symfony Bundle to generate database diagrams
jawira/plantuml-client                         1.0.3              Convert PlantUML diagrams into images.
jawira/plantuml-encoding                       1.1.0              PlantUML encoding functions
jawira/the-lost-functions                      1.7.0              Collection of convenience functions.
justinrainbow/json-schema                      5.2.13             A library to validate a json schema.
masterminds/html5                              2.9.0              An HTML5 parser and serializer.
monolog/monolog                                3.6.0              Sends your logs to files, sockets, inboxes, databases and various web services
myclabs/deep-copy                              1.11.1             Create deep copies (clones) of your objects
nelmio/cors-bundle                             2.4.0              Adds CORS (Cross-Origin Resource Sharing) headers support in your Symfony application
nelmio/security-bundle                         3.3.0              Extra security-related features for Symfony: signed/encrypted cookies, HTTPS/SSL/HSTS handlin...
nette/utils                                    4.0.4              ­ƒøá  Nette Utils: lightweight utilities for string & array manipulation, image handling, saf...
nikic/php-parser                               5.0.2              A PHP parser written in PHP
ondram/ci-detector                             4.2.0              Detect continuous integration environment and provide unified access to properties of current...
overtrue/phplint                               9.3.1              `phplint` is a tool that can speed up linting of php files by running several lint processes ...
pdepend/pdepend                                2.16.2             Official version of pdepend to be handled with Composer
phar-io/manifest                               2.0.4              Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                                3.2.1              Library for handling version information and constraints
phpmd/phpmd                                    2.15.0             PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known J...
phpmetrics/phpmetrics                          3.0.0rc6           Static analyzer tool for PHP : Coupling, Cyclomatic complexity, Maintainability Index, Halste...
phpstan/extension-installer                    1.4.0              Composer plugin for automatic installation of PHPStan extensions
phpstan/phpdoc-parser                          1.29.1             PHPDoc parser with support for nullable, intersection and generic types
phpstan/phpstan-deprecation-rules              1.2.0              PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and t...
phpstan/phpstan-doctrine                       1.4.3              Doctrine extensions for PHPStan
phpstan/phpstan-phpunit                        1.4.0              PHPUnit extensions and rules for PHPStan
phpstan/phpstan-strict-rules                   1.6.0              Extra strict and opinionated rules for PHPStan
phpstan/phpstan-symfony                        1.4.4              Symfony Framework extensions and rules for PHPStan
phpstan/phpstan                                1.11.4             PHPStan - PHP Static Analysis Tool
phpunit/php-code-coverage                      11.0.3             Library that provides collection, processing, and rendering functionality for PHP code covera...
phpunit/php-file-iterator                      5.0.0              FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                            5.0.0              Invoke callables with a timeout
phpunit/php-text-template                      4.0.0              Simple template engine.
phpunit/php-timer                              7.0.0              Utility class for timing
phpunit/phpunit                                11.2.0             The PHP Unit Testing framework.
psr/cache                                      3.0.0              Common interface for caching libraries
psr/clock                                      1.0.0              Common interface for reading the clock.
psr/container                                  2.0.2              Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                           1.0.0              Standard interfaces for event handling.
psr/log                                        3.0.0              Common interface for logging libraries
rector/rector                                  1.1.0              Instant Upgrade and Automated Refactoring of any PHP code
roave/security-advisories                      dev-latest cde5826 Prevents installation of composer packages with known security vulnerabilities: no API, simpl...
sanmai/later                                   0.1.4              Later: deferred wrapper object
sanmai/pipeline                                6.10               General-purpose collections pipeline
sebastian/cli-parser                           3.0.1              Library for parsing CLI options
sebastian/code-unit-reverse-lookup             4.0.0              Looks up which function or method a line of code belongs to
sebastian/code-unit                            3.0.0              Collection of value objects that represent the PHP code units
sebastian/comparator                           6.0.0              Provides the functionality to compare PHP values for equality
sebastian/complexity                           4.0.0              Library for calculating the complexity of PHP code units
sebastian/diff                                 6.0.1              Diff implementation
sebastian/environment                          7.1.0              Provides functionality to handle HHVM/PHP environments
sebastian/exporter                             6.0.1              Provides the functionality to export PHP variables for visualization
sebastian/global-state                         7.0.1              Snapshotting of global state
sebastian/lines-of-code                        3.0.0              Library for counting the lines of code in PHP source code
sebastian/object-enumerator                    6.0.0              Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector                     4.0.0              Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context                    6.0.0              Provides functionality to recursively process PHP variables
sebastian/type                                 5.0.0              Collection of value objects that represent the types of the PHP type system
sebastian/version                              5.0.0              Library that helps with managing the version number of Git-hosted PHP projects
shipmonk/phpstan-rules                         3.0.0              Various extra strict PHPStan rules we found useful in ShipMonk.
slam/phpstan-extensions                        6.3.0              Slam extension of phpstan
slevomat/coding-standard                       8.15.0             Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by provi...
spaze/phpstan-disallowed-calls                 3.4.0              PHPStan rules to detect disallowed method & function calls, constant, namespace & superglobal...
squizlabs/php_codesniffer                      3.10.1             PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined s...
struggle-for-php/sfp-phpstan-psr-log           0.21.0             Extra strict and opinionated psr/log (psr-3) rules for PHPStan
struggle-for-php/sfp-stubs-psr-log             3.0.2              Stubs to let Static Analysis understand psr/log (PSR-3)
symfony/asset                                  7.1.1              Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files...
symfony/browser-kit                            7.1.1              Simulates the behavior of a web browser, allowing you to make requests, click on links and su...
symfony/cache-contracts                        3.5.0              Generic abstractions related to caching
symfony/cache                                  7.1.1              Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/clock                                  7.1.1              Decouples applications from the system clock
symfony/config                                 7.1.1              Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/console                                7.1.1              Eases the creation of beautiful and testable command line interfaces
symfony/css-selector                           7.1.1              Converts CSS selectors to XPath expressions
symfony/debug-bundle                           7.1.1              Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from...
symfony/dependency-injection                   7.1.1              Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts                  3.5.0              A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge                        7.1.1              Provides integration for Doctrine with various Symfony components
symfony/dom-crawler                            7.1.1              Eases DOM navigation for HTML and XML documents
symfony/dotenv                                 7.1.1              Registers environment variables from a .env file
symfony/error-handler                          7.1.1              Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher-contracts             3.5.0              Generic abstractions related to dispatching event
symfony/event-dispatcher                       7.1.1              Provides tools that allow your application components to communicate with each other by dispa...
symfony/filesystem                             7.1.1              Provides basic utilities for the filesystem
symfony/finder                                 7.1.1              Finds files and directories via an intuitive fluent interface
symfony/flex                                   2.4.5              Composer plugin for Symfony
symfony/form                                   7.1.1              Allows to easily create, process and reuse HTML forms
symfony/framework-bundle                       7.1.1              Provides a tight integration between Symfony components and the Symfony full-stack framework
symfony/http-foundation                        7.1.1              Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                            7.1.1              Provides a structured process for converting a Request into a Response
symfony/intl                                   7.1.1              Provides access to the localization data of the ICU library
symfony/mailer                                 7.1.1              Helps sending emails
symfony/maker-bundle                           1.59.1             Symfony Maker helps you create empty commands, controllers, form classes, tests and more so y...
symfony/mime                                   7.1.1              Allows manipulating MIME messages
symfony/monolog-bridge                         7.1.1              Provides integration for Monolog with various Symfony components
symfony/monolog-bundle                         3.10.0             Symfony MonologBundle
symfony/options-resolver                       7.1.1              Provides an improved replacement for the array_replace PHP function
symfony/password-hasher                        7.1.1              Provides password hashing utilities
symfony/polyfill-uuid                          1.29.0             Symfony polyfill for uuid functions
symfony/process                                7.1.1              Executes commands in sub-processes
symfony/property-access                        7.1.1              Provides functions to read and write from/to an object or array using a simple string notation
symfony/property-info                          7.1.1              Extracts information about PHP class' properties using metadata of popular sources
symfony/routing                                7.1.1              Maps an HTTP request to a set of configuration variables
symfony/runtime                                7.1.1              Enables decoupling PHP applications from global state
symfony/security-bundle                        7.1.1              Provides a tight integration of the Security component into the Symfony full-stack framework
symfony/security-core                          7.1.1              Symfony Security Component - Core Library
symfony/security-csrf                          7.1.1              Symfony Security Component - CSRF Library
symfony/security-http                          7.1.1              Symfony Security Component - HTTP Integration
symfony/service-contracts                      3.5.0              Generic abstractions related to writing services
symfony/string                                 7.1.1              Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and graphe...
symfony/thanks                                 1.3.0              Encourages sending Ô¡É and ­ƒÆÁ to fellow PHP package maintainers (not limited to Symfony com...
symfony/translation-contracts                  3.5.0              Generic abstractions related to translation
symfony/translation                            7.1.1              Provides tools to internationalize your application
symfony/twig-bridge                            7.1.1              Provides integration for Twig with various Symfony components
symfony/twig-bundle                            7.1.1              Provides a tight integration of Twig into the Symfony full-stack framework
symfony/type-info                              7.1.1              Extracts PHP types information.
symfony/uid                                    7.1.1              Provides an object-oriented API to generate and represent UIDs
symfony/validator                              7.1.1              Provides tools to validate values
symfony/var-dumper                             7.1.1              Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter                           7.1.1              Allows exporting any serializable PHP data structure to plain PHP code
symfony/web-profiler-bundle                    7.1.1              Provides a development tool that gives detailed information about the execution of any request
symfony/yaml                                   7.1.1              Loads and dumps YAML files
symplify/phpstan-rules                         12.7.0             Set of Symplify rules for PHPStan
thecodingmachine/phpstan-safe-rule             1.2.0              A PHPStan rule to detect safety issues. Must be used in conjunction with thecodingmachine/safe
thecodingmachine/phpstan-strict-rules          1.0.0              A set of additional rules for PHPStan based on best practices followed at TheCodingMachine
thecodingmachine/safe                          2.5.0              PHP core functions that throw exceptions instead of returning FALSE on error
theseer/tokenizer                              1.2.3              A small library for converting tokenized PHP source code into XML and potentially other formats
tomasvotruba/type-coverage                     0.3.0              Measure type coverage of your project
tomasvotruba/unused-public                     0.3.9              Detect unused public properties, constants and methods in your code
twig/extra-bundle                              3.10.0             A Symfony bundle for extra Twig extensions
twig/twig                                      3.10.3             Twig, the flexible, fast, and secure template language for PHP
ua-parser/uap-php                              3.9.14             A multi-language port of Browserscope's user agent parser.
voku/phpstan-rules                             3.2.0              Provides additional rules for phpstan/phpstan.
webmozart/assert                               1.11.0             Assertions to validate method input/output with nice error messages.

Expected behavior

"--migrate-configuration" should change the configuration to something it considers valid.

@knallcharge knallcharge added the type/bug Something is broken label Jun 10, 2024
@sebastianbergmann
Copy link
Owner

This is caused by a9b92ee, which removed a leftover of #4600 from the XML configuration file schema. The <coverage> element has a cacheDirectory attribute, this is what makes the configuration file invalid.

I can confirm that this is an issue in the XML configuration file migrator. It will eventually be fixed, I am sure, but in the meantime I suggest that you manually migrate your XML configuration file. The cacheDirectory attribute of the <coverage> element does not have any effect since PHPUnit 11.0.0.

@sebastianbergmann sebastianbergmann changed the title PHPUnit 11.1 to 11.2: Your XML configuration validates against a deprecated schema. XML Configuration File Migrator does not remove cacheDirectory attribute from <coverage> element when migrating from PHPUnit 11.1 to PHPUnit 11.2 Jun 10, 2024
@sebastianbergmann sebastianbergmann self-assigned this Jun 10, 2024
@knallcharge
Copy link
Author

Great, thanks for the quick reply! I can confirm that the message goes away when removing cacheDirectory from <coverage>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/configuration/xml type/bug Something is broken version/11 Something affects PHPUnit 11
Projects
None yet
Development

No branches or pull requests

2 participants