我尝试从 PHP 7 迁移到 PHP 8。我更新了所有依赖项,然后使用以下命令转换 PHPUnit 配置:
./vendor/bin/phpunit -c phpunit.xml --migrate-configuration
问题是不再生成覆盖率报告?!虽然所有测试都可以。
这是 phpunit.xml 文件的结果:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
bootstrap="./vendor/autoload.php"
stopOnWarning="false"
verbose="false"
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
colors="true">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
<directory suffix=".php">./http-process</directory>
</include>
<report>
<clover outputFile=".build/clover.xml" />
<html outputDirectory=".build/coverage" />
</report>
</coverage>
<php>
<var name="DB_DSN" value="sqlite::memory:" />
<var name="DB_USER" value="root" />
<var name="DB_PASSWD" value="" />
<var name="DB_DBNAME" value="pluf_test" />
<var name="DB_SCHEMA" value="sqlite" />
</php>
<testsuites>
<testsuite name="http process">
<directory>./tests/Process/Http/</directory>
</testsuite>
</testsuites>
<!-- Code coverage -->
<logging />
</phpunit>
所有测试运行正常,但没有覆盖率报告!!。