pcov icon indicating copy to clipboard operation
pcov copied to clipboard

Wrong coverage

Open ghost opened this issue 2 years ago • 0 comments

Hello

I'm trying to setup code coverage on my Symfony app. Here is my configuration :

php-code-coverage 9.2.27 using PHP 8.2.8 and PHPUnit 9.6.10

Command used: php -d xdebug.mode=off -d pcov.enabled=1 -d pcov.directory=. -d pcov.exclude="~vendor~" bin/phpunit --coverage-clover='reports/coverage/coverage.xml' --coverage-html='reports/coverage'

My test file:

 #[NoReturn] public function testAuth(): void
    {
        $response = self::$client->post('/api/auth', [
            'json' => [
                'username' => self::$exampleUser->getUsername(),
                  'password' => self::$exampleUser->getTextPassword()
            ]
        ]);

        $responseDecoded = json_decode($response->getBody()->read($response->getBody()->getSize()), true);

        $this->assertTrue(true); // Dumb assert, it's ok
    }

The issue is : when I'm testing my app (using Guzzle client), the controllers and services are not covered (0%) Only the.. entity folder

ghost avatar Aug 04 '23 09:08 ghost