Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Empty <coverage> element in XML configuration after migrating configuration #5612

Closed
arogachev opened this issue Dec 11, 2023 · 2 comments
Closed
Assignees
Labels
feature/configuration/xml type/enhancement A new idea that should be implemented version/10 Something affects PHPUnit 10

Comments

@arogachev
Copy link

arogachev commented Dec 11, 2023

Q A
PHPUnit version 10.5.2
PHP version 8.2.12
Installation Method Composer / PHAR

Summary

There is empty <coverage/> tag after migrating configuration which seems to be useless.

Current behavior

Empty tag is present. New config.

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true" failOnRisky="true" failOnWarning="true" stopOnFailure="false" executionOrder="random" resolveDependencies="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache">
  <php>
    <ini name="error_reporting" value="-1"/>
  </php>
  <testsuites>
    <testsuite name="Yii Role-Based Access Control tests">
      <directory>./tests</directory>
    </testsuite>
  </testsuites>
  <coverage/> <!-- Here it is.  -->
  <source>
    <include>
      <directory>./src</directory>
    </include>
  </source>
</phpunit>

How to reproduce

Old config (phpunit.xml.dist):

<?xml version="1.0" encoding="UTF-8"?>

<phpunit
    bootstrap="vendor/autoload.php"
    colors="true"
    verbose="true"
    failOnRisky="true"
    failOnWarning="true"
    convertErrorsToExceptions="true"
    convertNoticesToExceptions="true"
    convertWarningsToExceptions="true"
    stopOnFailure="false"
    executionOrder="random"
    resolveDependencies="true"
>
    <php>
        <ini name="error_reporting" value="-1"/>
    </php>

    <testsuites>
        <testsuite name="Yii Role-Based Access Control tests">
            <directory>./tests</directory>
        </testsuite>
    </testsuites>

    <coverage>
        <include>
            <directory>./src</directory>
        </include>
    </coverage>
</phpunit>
vendor/bin/phpunit --migrate-configuration

Expected behavior

No empty tag.

@arogachev arogachev added type/bug Something is broken version/10 Something affects PHPUnit 10 labels Dec 11, 2023
@sebastianbergmann sebastianbergmann added type/enhancement A new idea that should be implemented feature/configuration/xml and removed type/bug Something is broken labels Dec 11, 2023
@sebastianbergmann
Copy link
Owner

I would not consider this a bug, but yes, this can be improved.

@marac19901990
Copy link
Contributor

I made a pull request for this issue:
#5626

@sebastianbergmann sebastianbergmann changed the title Empty tag in XML configuration after migrating configuration Empty <coverage> element in XML configuration after migrating configuration Dec 27, 2023
@sebastianbergmann sebastianbergmann self-assigned this Dec 27, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature/configuration/xml type/enhancement A new idea that should be implemented version/10 Something affects PHPUnit 10
Projects
None yet
Development

No branches or pull requests

3 participants