[英]Coverage phpunit on Laravel 5.2
我執行PhPUnit,無法生成覆蓋率報告,Laravel ver: 5.2 Php ver: 7.3.11。 日志輸出為:
PHPUnit 4.8.36 由 Sebastian Bergmann 和貢獻者編寫。 .
時間:1.51 秒,內存:22.00MB
OK(1 個測試,1 個斷言)
生成 HTML 格式的代碼覆蓋率報告 ...count(): 參數必須是數組或實現 Countable 的對象
我不知道這里有什么問題? 這是我的測試源:
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Http\Response;
class TravelControllerTest extends TestCase
{
/**
* A basic functional test example.
*
* @return void
*/
public function testBasicExample()
{
$response = $this->json('GET', '/v1/abc', ['id' => 'Sally']);
$response->assertSessionHas('temporary_id', $value = 'Sally');
}
}
升級 PHPUnit 和 PhpCodeCoverage 包將是解決方案。 你的包已經很過時了! 這是舊版本的錯誤。
以下是有關此主題的一些討論:
https://github.com/Codeception/Codeception/issues/4703
https://github.com/sebastianbergmann/php-code-coverage/issues/551
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.