2013-12-19 214 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