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
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
...
<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.
Aucun commentaire:
Enregistrer un commentaire