2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Laravel]Warning:XML configuration validates against a deprecated schema.

Posted at

はじめに

この記事はプログラミング初学者による備忘録用の記事であり、また、少しでも他の初学者のお役に立てればと思い書いています。

今回は、PHPUnitを使用したテスト実行時に、Warning:Your XML configuration validates against a deprecated schema. Suggestion: Migrate your XML configuration using "--migrate-configuration"!という警告が発生しましたので解決策を記録しておきます。

間違いなどがございましたら、ご指摘のほどよろしくお願い致します。

警告文

$ vendor/bin/phpunit tests/Feature/ArticleControllerTest.php
PHPUnit 9.5.2 by Sebastian Bergmann and contributors.

Warning:Your XML configuration validates against a deprecated schema.
Suggestion:Migrate your XML configuration using "--migrate-configuration"!
//略

原因

PHPUnit 9.3.0 では、カバレッジのフィルタリングがfilterタグからcoverageタグに変更されたらしいです。

参考 https://github.com/sebastianbergmann/phpunit/blob/master/phpunit.xml
https://github.com/laravel/dusk/pull/811

確認してみると、laravel6.xのphpunit.xmlではfilterタグが使用されていました。

laravel6.xのphpunit.xml
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./app</directory>
        </whitelist>
    </filter>
PHPUnit9.3.0以降のphpunit.xml
 <coverage ignoreDeprecatedCodeUnits="true">
        <include>
            <directory suffix=".php">src</directory>
        </include>

        <exclude>
            <file>src/Framework/Assert/Functions.php</file>
            <file>src/Util/PHP/eval-stdin.php</file>
        </exclude>
    </coverage>

これらの違いから警告文が表示されたと思われます。

解決策

<!--
<filter>
    <whitelist processUncoveredFilesFromWhitelist="true">
        <directory suffix=".php">./app</directory>
    </whitelist>
</filter>
-->
<coverage processUncoveredFiles="true">
    <include>
        <directory suffix=".php">./app</directory>
    </include>
</coverage>

このように変更したことで、警告文が消えました。
コメントアウトしていますが、削除しても問題ないと思います。

参考文献

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?