Open llaville opened 3 weeks ago
FYI: related to my previous report https://github.com/sebastianbergmann/phpunit/issues/6019, when there is a change in configuration (even if it's not expected, like includeUncoveredFiles
attribute missing), the schema change is well detected.
it will be cool if we can same identation after migration
While I agree that losing indentation is an inconvenience, it is annoying enough to invest time/effort in finding a solution to keep it.
I've noticed that documentation still identify the includeUncoveredFiles
attribute, but not the schema 11.4 while schema 10.4 did it.
So, after re-introduced the attribute missing in my phpunit.xml.dist
config file, I got another (wrong/not expected) warning
There was 1 PHPUnit test runner deprecation:
1) Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!
I think it's an issue, because includeUncoveredFiles
is not identify by v11.4
Oops, I've in mind schema 10.5 and I present schema 10.4, but both identify correctly the missing attribute.
@see https://github.com/sebastianbergmann/phpunit/blob/main/schema/10.5.xsd#L65
While I agree that losing indentation is an inconvenience, it is annoying enough to invest time/effort in finding a solution to keep it.
Agree with you that it's time consuming. But I'll give you the solution, because I wanted to learn more about PHPUnit migration command.
With DOMDocument, when you set preserveWhiteSpace
and formatOutput
properties before loading file contents, it won't preserve indentation, and if you did it after it works.
Preserve indentation
<?php
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml.dist';
$configurationDocument = new \DOMDocument();
// either
//$configurationDocument->load($filename);
// or
$configurationDocument->loadXML(file_get_contents($filename));
$configurationDocument->preserveWhiteSpace = false;
$configurationDocument->formatOutput = true;
var_export($configurationDocument->saveXML());
DO NOT preserve indentation
<?php
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml.dist';
$configurationDocument = new \DOMDocument();
$configurationDocument->preserveWhiteSpace = false;
$configurationDocument->formatOutput = true;
// either
//$configurationDocument->load($filename);
// or
$configurationDocument->loadXML(file_get_contents($filename));
var_export($configurationDocument->saveXML());
In summary to fix PHPUnit, you have just to remove the line https://github.com/sebastianbergmann/phpunit/blob/11.4/src/Util/Xml/Loader.php#L67 because the good lines in right place are already defined at https://github.com/sebastianbergmann/phpunit/blob/11.4/src/TextUI/Configuration/Xml/Migration/Migrator.php#L47-L48
Hello,
Working on my project BOX Manifest and wanted to migrate from PHPUnit 10 to 11, I've noticed that include uncovered files option was not included during migration process.
After installing PHPUnit 11.4.3, I've checks for regressions with following command :
And got this output :
So I've run migration process with following command :
Anf got result :
But when I compare versions, I was surprised on
coverage
section that missed previous attributeincludeUncoveredFiles
Checks with command :
That prints :
BTW, it will be cool if we can same identation after migration. Even if my PHP editor is able to easily re-indent code !