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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community