[英]Coverage phpunit on Laravel 5.2
I excute PhPUnit, The coverage report can not generate, Laravel ver: 5.2 Php ver: 7.3.11.我执行PhPUnit,无法生成覆盖率报告,Laravel ver: 5.2 Php ver: 7.3.11。 Log output is:日志输出为:
PHPUnit 4.8.36 by Sebastian Bergmann and contributors. PHPUnit 4.8.36 由 Sebastian Bergmann 和贡献者编写。 . .
Time: 1.51 seconds, Memory: 22.00MB时间:1.51 秒,内存:22.00MB
OK (1 test, 1 assertion) OK(1 个测试,1 个断言)
Generating code coverage report in HTML format ...count(): Parameter must be an array or an object that implements Countable生成 HTML 格式的代码覆盖率报告 ...count(): 参数必须是数组或实现 Countable 的对象
I don't know what wrong here?我不知道这里有什么问题? Here is my test source:这是我的测试源:
<?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');
}
}
Upgrade the PHPUnit and PhpCodeCoverage packages would be the solution.升级 PHPUnit 和 PhpCodeCoverage 包将是解决方案。 You're packages are very outdated!你的包已经很过时了! It's a bug in older versions.这是旧版本的错误。
Here are some discussions about this topic:以下是有关此主题的一些讨论:
https://github.com/Codeception/Codeception/issues/4703 https://github.com/Codeception/Codeception/issues/4703
https://github.com/sebastianbergmann/php-code-coverage/issues/551 https://github.com/sebastianbergmann/php-code-coverage/issues/551
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.