Support the ongoing development of Laravel.io →
Laravel Testing

I'm trying to add the code-coverage report feature for phpunit in Laravel 6 by following the tutorial https://coderwall.com/p/mxtqiw/add-code-coverage-report-to-laravel-project

after adding the logging node on the phpunit.php file

<phpunit> ... <logging> <log type="coverage-html" target="./report" lowUpperBound="50" highLowerBound="80" /> </logging> </phpunit> and running the command

vendor/bin/phpunit (or just simply running vendor/bin/phpunit --coverage-html reports/ Without adding the logging node in phpunit.php)

it shows

PHP Fatal error: Uncaught ReflectionException: Class view does not exist in /mnt/d/User/Projects/63.Roundrobinapp/proj/vendor/laravel/framework/src/Illuminate/Container/Container.php:803 Stack trace: #0 /mnt/d/User/Projects/63.Roundrobinapp/proj/vendor/laravel/framework/src/Illuminate/Container/Container.php(803): ReflectionClass->__construct('view') #1 /mnt/d/User/Projects/63.Roundrobinapp/proj/vendor/laravel/framework/src/Illuminate/Container/Container.php(681): Illuminate\Container\Container->build('view') #2 /mnt/d/User/Projects/63.Roundrobinapp/proj/vendor/laravel/framework/src/Illuminate/Container/Container.php(629): Illuminate\Container\Container->resolve('view', Array) #3 /mnt/d/User/Projects/63.Roundrobinapp/proj/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(120): Illuminate\Container\Container->make('view', Array) #4 /mnt/d/User/Projects/63.Roundrobinapp/proj/app/Admin/bootstrap.php(47): app('view') #5 /mnt/d/User/Projects/63.Roundrobinapp/proj/vendor/phpunit/php-code-cov in /mnt/d/User/Projects/63.Roundrobinapp/proj/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 805 I've tried using the solutions from similar problems such as installing xdebug, using composer dump-autoload -o, and cleaning the folder bootstrap/cache/*.php, but still no avail.

Any help? or just simply give me the right way to add code coverage in Laravel would be appreciated.

Thanks.

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.