0
votes

I excute PhPUnit, The coverage report can not generate, Laravel ver: 5.2 Php ver: 7.3.11. Log output is:

PHPUnit 4.8.36 by Sebastian Bergmann and contributors. .

Time: 1.51 seconds, Memory: 22.00MB

OK (1 test, 1 assertion)

Generating code coverage report in HTML format ...count(): Parameter must be an array or an object that implements 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');
    }
}
1
What's the reason to use PHPUnit 4 and on PHP 7.3?thmspl

1 Answers

0
votes

Upgrade the PHPUnit and PhpCodeCoverage packages would be the solution. 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/sebastianbergmann/php-code-coverage/issues/551