2013-12-19 176 views
1

我试图让我的代码覆盖率报告涵盖了我所有的laravel应用程序代码(控制器和模型)。由于某些原因,它只能覆盖一个测试。下面的配置有什么问题吗?Laravel代码覆盖范围

<phpunit colors="true" 
     bootstrap="/Users/bob/projects/leonardo2/laravel/cli/tasks/test/phpunit.php" 
     backupGlobals="false"> 

    <testsuites> 
    <testsuite name="Test Suite"> 
         <directory suffix=".test.php">/Users/bob/projects/leonardo2/application/tests</directory> 
        </testsuite> 
    </testsuites> 

    <filter> 
    <blacklist>  
     <exclude> 
      <directory suffix=".test.php">/Users/bob/projects/leonardo2/application/tests</directory> 
     </exclude> 
    </blacklist> 
    <whitelist> 
     <exclude> 
     <directory suffix=".php">/Users/bob/projects/leonardo2/application/config</directory>  
     <directory suffix=".php">/Users/bob/projects/leonardo2/application/views</directory> 
     <directory suffix=".php">/Users/bob/projects/leonardo2/application/migrations</directory> 
     <directory suffix=".php">/Users/bob/projects/leonardo2/application/libraries</directory> 
     <directory suffix=".php">/Users/bob/projects/leonardo2/application/tasks</directory> 
     <directory suffix=".php">/Users/bob/projects/leonardo2/application/language</directory> 
     </exclude> 
    </whitelist> 
    </filter> 

    <logging> 
     <log type="coverage-html" target="./storage/work/report/" charset="UTF-8" 
     highlight="false" lowUpperBound="35" highLowerBound="70"/> 
    </logging> 
</phpunit> 
+0

您是否尝试将您的phpunit.xml文件恢复为基础知识以查看其是否包含所有内容?另外,我不认为需要aboslute路径,并且如果其他人尝试运行测试,它会中断。 –

回答

0

这么复杂的调节是不需要我猜。只需将过滤器标记下的白名单中的应用程序目录添加进去即可。

<filter> 
    <whitelist> 
     <directory suffix=".php">app/</directory> 
    </whitelist> 
</filter> 

请点击此链接以获得更好的理解。 Add Code Coverage Report to Laravel Project