2017-06-14 120 views
1

我在php 7.0和7.2上運行一個關於travis-ci的php構建矩陣。爲什麼代碼覆蓋率報告在php 7.2上失敗?

https://travis-ci.org/uawcob/course-overrides/jobs/242630482

在7.0,測試全部通過,並生成代碼覆蓋率的罰款。

php 7 screenshot passes great

在7.2,你可以看到,所有的測試運行,並通過相同的,但生成的代碼覆蓋率報告拋出這導致整個構建以失敗異常。

screenshot php 7.2 code coverage exception

這是爲什麼?爲後人

完整的錯誤堆棧:

Generating code coverage report in HTML format ...PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php:895 
Stack trace: 
#0 /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php(735): Illuminate\Container\Container->notInstantiable('Illuminate\\Cont...') 
#1 /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php(608): Illuminate\Container\Container->build('Illuminate\\Cont...') 
#2 /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php(575): Illuminate\Container\Container->resolve('Illuminate\\Cont...') 
#3 /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(728): Illuminate\Container\Container->make('Illuminate\\Cont...') 
#4 /home/travis/build/uawcob/cour in /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 895 
Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 895 
Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 895 
Call Stack: 
    3.7921 6622616 1. Illuminate\Foundation\Bootstrap\HandleExceptions->handleException() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:0 
    3.7921 6622616 2. Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:80 
    3.7921 6622616 3. Illuminate\Foundation\Application->make() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:155 
    3.7921 6622616 4. Illuminate\Foundation\Application->make() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:728 
    3.7921 6622616 5. Illuminate\Foundation\Application->resolve() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php:575 
    3.7921 6622616 6. Illuminate\Foundation\Application->build() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php:608 
    3.7921 6622728 7. Illuminate\Foundation\Application->notInstantiable() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php:735 
PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php:895 
Stack trace: 
#0 /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php(735): Illuminate\Container\Container->notInstantiable('Illuminate\\Cont...') 
#1 /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php(608): Illuminate\Container\Container->build('Illuminate\\Cont...') 
#2 /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php(575): Illuminate\Container\Container->resolve('Illuminate\\Cont...') 
#3 /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(728): Illuminate\Container\Container->make('Illuminate\\Cont...') 
#4 /home/travis/build/uawcob/cour in /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 895 
Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 895 
Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 895 
Call Stack: 
    3.7929 6633672 1. Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:0 
    3.7938 6641592 2. Illuminate\Foundation\Bootstrap\HandleExceptions->handleException() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:119 
    3.7938 6641592 3. Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:80 
    3.7938 6641592 4. Illuminate\Foundation\Application->make() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:155 
    3.7938 6641592 5. Illuminate\Foundation\Application->make() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:728 
    3.7938 6641592 6. Illuminate\Foundation\Application->resolve() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php:575 
    3.7939 6641592 7. Illuminate\Foundation\Application->build() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php:608 
    3.7939 6641704 8. Illuminate\Foundation\Application->notInstantiable() /home/travis/build/uawcob/course-overrides/vendor/laravel/framework/src/Illuminate/Container/Container.php:735 

回答

2

尋找到你對於確切的錯誤信息代碼,the proposed fix upstream是排除從代碼覆蓋的./app/Http/routes.php文件:

... 
<whitelist processUncoveredFilesFromWhitelist="true"> 
    <directory suffix=".php">./app</directory> 
     <exclude> 
      <file>./app/Http/routes.php</file> 

      <!--^^^^^^^^^^^^^--> 

... 

這是從一個快速檢查你的項目的構建源失敗,顯示這還沒有設置在phpunit.xml.dist文件。我不能說爲什麼只發生在PHP 7.2版本中。所以,這可以擺脫更多的光線,也許這響起了一個鐘聲(例如不同的Phpunit版本)。

+0

感謝您的提示!我在深入挖掘,但看起來這是一箇舊的改變,它被合併,後來被刪除。也許這個問題已經在PHP 7.2 –

+0

中再次冒出來了,它仍然是壞的:https://travis-ci.org/uawcob/course-overrides/jobs/244729795 –

相關問題