首页 > 解决方案 > PHPunit 警告错误测试套件不是预期的

问题描述

我是使用 PHPunit 的新手。我用 composer 安装了 PHPunit 并创建了一个 phpunit.xml 文件:

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

    <phpunit bootstrap="vendor/autoload.php" colors="true">
        <testsuits>
            <testsuit name="unit">
                <directory>tests</directory>
            </testsuit>
        </testsuits>
    </phpunit>

我收到以下错误消息

Sebastian Bergmann 和贡献者的 PHPUnit 7.5.16。

警告 - 配置文件未通过验证!已检测到以下问题:

第 4 行: - 元素“testsuits”:不需要此元素。

测试结果可能不如预期。

标签: phpphpunit

解决方案


您的文件有错字,<testsuites>而不是<testsuits>,也为,<testsuite>而不是<testsuit>

https://phpunit.readthedocs.io/en/8.3/configuration.html#the-testsuites-element


推荐阅读