-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Confusing error message when migration of a configuration is requested that does not need to be migrated #5673
Comments
This is an "interesting" issue, Oliver, and I am thankful that you reported it. "Interesting" because it has been quite a while since I looked at a higher level than PHPUnit 10.5.7 ships with XML schema definitions for PHPUnit 10.5.7 as well as PHPUnit 8.5, PHPUnit 9.2, PHPUnit 9.5, and PHPUnit 10.0.
The issue tracked here is caused by the fact that the XML configuration file to be migrated is not valid according to either of the schema definitions that are tried as the I doubt that the issue tracked here is the only one in the configuration file migration functionality ... |
@theseer Do you have an idea what should be done here (since you did the original design of the configuration file migration functionality)? |
Well, for hopefully obvious reasons we cannot (reliably) migrate a configuration file that contains attributes (or nodes, for that matter) that are invalid in the respective version the configuration file claims to be targeted at. In your assessment above you list we're looping over 10.0 and lower versions. Apparently, that's not a complete list, given you said we have added these attributes at 10.1. So, for starters, there should be (or have been) a different schema for that version. As far as I understand the situation, we have a configuration file that is not compliant to any schema version as it mixes elements from various versions. For the migration logic, I would consider this a won't fix. All we can do is fail "nicer" by telling the user the configuration file is not valid before attempting migrations. Does that make sense or am I thinking in the wrong direction? |
AFAICS, the configuration file that @oliverklee is trying to migrate is valid with PHPUnit 10.5 and does not require migration. |
I agree and that is the first thing that I will look into: ship |
That's not necessarily a contradiction to what I wrote ;) I didn't look into the code (yet) but there must be something "off" with either the file or its matching schema version so we believe to have to migrate. I'll have a look at it later if you want me to. |
Thank you for offering your time, but at the moment that is not necessary. |
The We error out when the to-be-migrated XML configuration file does not validate against any known schema. And we "error out" when it validates against the current schema (and therefore does not require migration). Of course, more work needs to be done here. |
failOnNotice
or failOnDeprecation
are set
The next releases of PHPUnit 9.6 and PHPUnit 10.5 will handle this situation better. |
Summary
Migrating a PHPUnit configuration file fails with an error message if
failOnNotice
orfailOnDeprecation
are set (or both).According to https://docs.phpunit.de/en/10.5/configuration.html, these two options are available and valid.
With PHPUnit 9, this problem does not occur.
Current behavior
(ditto for the other configuration file)
How to reproduce
git clone git@github.com:oliverklee/phpunit-10-config-test.git cd phpunit-10-config-test composer install ./vendor/bin/phpunit --migrate-configuration -c FailOnDeprecation.xml ./vendor/bin/phpunit --migrate-configuration -c FailOnNotice.xml
Expected behavior
(ditto for the other configuration file)
The text was updated successfully, but these errors were encountered: