-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
type/bugSomething is brokenSomething is brokenversion/10Something affects PHPUnit 10Something affects PHPUnit 10version/9Something affects PHPUnit 9Something affects PHPUnit 9
Description
| Q | A |
|---|---|
| PHPUnit version | 10.2.1, 9.6.8 |
| PHP version | 8.2.5, 8.0.28 |
| Installation Method | Composer |
Summary
Migration fails if the <whitelist> uses <file>.
Current behavior
$ vendor/bin/phpunit --migrate-configuration
PHPUnit 10.2.1 by Sebastian Bergmann and contributors.
Created backup: /tmp/test/phpunit.xml.dist.bak
Migration failed: whitelist element has unexpected children
$ vendor/bin/phpunit --migrate-configuration
PHPUnit 9.6.8 by Sebastian Bergmann and contributors.
Created backup: /tmp/test/phpunit.xml.dist.bak
Migration failed: whitelist element has unexpected children
How to reproduce
- Create a
phpunit.xml.distlike this, which is valid in older versions of PHPUnit.<phpunit> <testsuites> <testsuite name="main"> <directory suffix=".php">tests/php</directory> </testsuite> </testsuites> <filter> <whitelist> <file>./*.php</file> <directory suffix=".php">src</directory> </whitelist> </filter> </phpunit>
- Run
vendor/bin/phpunit --migrate-configuration
Expected behavior
Migration succeeds, producing this valid PHPUnit 10.2.1 configuration.
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" cacheDirectory=".phpunit.cache">
<coverage/>
<testsuites>
<testsuite name="main">
<directory suffix=".php">tests/php</directory>
</testsuite>
</testsuites>
<source>
<include>
<file>./*.php</file>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>or this valid PHPUnit 9.6 configuration
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<file>./*.php</file>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="main">
<directory suffix=".php">tests/php</directory>
</testsuite>
</testsuites>
</phpunit>Metadata
Metadata
Assignees
Labels
type/bugSomething is brokenSomething is brokenversion/10Something affects PHPUnit 10Something affects PHPUnit 10version/9Something affects PHPUnit 9Something affects PHPUnit 9