I am using Laravel to build my own website, and I want to know the coverage for my source code during a user interaction event instead of writing testing cases using PHPUnit.
From my perspective, PHPUnit only generate reports that the unit tests touch, but if I want to get the code coverage during the execution, meaning generate the code coverage report after php artisan serve
What should I do to achieve this feature? For instance:
$filter = new Filter;
$filter->includeDirectory('/path/to/directory');
$coverage = new CodeCoverage(
(new Selector)->forLineCoverage($filter),
$filter
);
$coverage->start();
// Some User Interactions to the Web Service
$coverage->stop();
// Generating reports during the interactions
(new HtmlReport)->process($coverage, '/tmp/code-coverage-report');
All comments, answers, and bits of advice are welcome.
Thank you.