且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误:使用Orchestra Testbench测试独立的Laravel软件包时,在route.php中找不到类"Route"

更新时间:2023-02-24 07:46:52

事实证明,答案非常简单.我只需要从测试覆盖率生成中排除路由文件:

As it turned out, the answer was fairly straightforward. I just needed to exclude the routes file from the test coverage generation:

<filter>
    <whitelist processUncoveredFilesFromWhitelist="true">
        <directory suffix=".php">./src</directory>
        <exclude>
            <directory suffix=".php">./src/database</directory>
            <file>./src/routes.php</file>
        </exclude>
    </whitelist>
</filter>