31 questions
2
votes
1
answer
424
views
Generate code coverage for a single test suite
I wish to determine which files are covered by each of my test suites separately. I am using PHPUnit 10.5 with Xdebug for code coverage on my PHP 8.1 project.
Here is what my phpunit.xml configuration ...
1
vote
0
answers
763
views
Warning: XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set
I need to test my code and coverage. I already install Xdebug extension
What I have in my local is
PHP & xdebug version
PHP 8.1.20 (cli) (built: Jun 14 2023 05:48:10) (NTS)
Copyright (c) The PHP ...
0
votes
0
answers
123
views
How to do unit coverage reporting in php using proxy classes
In php, there are many aop packages that generate proxy classes to replace the original classes in the composer class map. I'm not sure how to properly generate a code coverage report if this is the ...
0
votes
0
answers
45
views
Get PHP project coverage in real time without ending the program running
I want to test the coverage of a php web application.
I need to get the coverage in real time while the program is running, like nyc or jacoco.
Instead of getting it when ending the program, or ...
1
vote
1
answer
2k
views
Sonarqube code coverage is 0% though scan was successful in Github Action for php app
I have a github action which runs the php unit test followed by Sonarqube scanner but the Sonarqube code coveage is always 0%
Phpunit Test is ok
Sonaiqube ok as well but no CodeCoverage
These is my ...
2
votes
1
answer
734
views
php - PHPUnit with PCOV code coverage show 0% coverage on window
I use phpUnit with PCOV on code coverage on window. But somehow, I get 0.0% code coverage. I am sure the function is called. Why is this happening?
Versions:
PHP: 8.1.12
PHPUnit: 9.5.0
PCOV: 1.0.11
...
0
votes
1
answer
171
views
PHP Core - where can I find the code coverage report in azure pipelines?
Maybe I am burn out but:
Anyone knows how can I see the code coverage report in Azure Pipelines of the PHP Core project? I have this link: https://dev.azure.com/phpazuredevops/PHP/_build?...
1
vote
0
answers
205
views
PHP code coverage - Understanding path coverage
I just started working on a piece of software using PHP 7.4.27 with PHPUnit 9.5.7 and Xdebug 2.9.8. I am collection code coverage including branch and path coverage information for all my unit tests. ...
0
votes
0
answers
2k
views
How to use PHPUnit code-coverage-tool PCOV in PhpStorm
I use PHP 7.4.13, PhpStorm 2020.1.4, PHPUnit 9.5.8.
I try to use PHPUnit code coverage tool with PCOV, but I don't get it to work.
I installed pcov:
pecl install pcov
I enabled the extension in the ...
3
votes
2
answers
3k
views
How to get a simple phpunit codecoverage summary in text output?
I use PHPUnit 9.5.7 on php 8.0.3
I would like to have a checker for minimum code coverage of lines as a git hook.
I have seen in online examples a simple 3 line output as a summary after running the ...
3
votes
2
answers
8k
views
Generating code coverage report in Clover XML format ... syntax error
I'm using phpstorm and wrote some test in my laravel app. The phpunit.xml is alsmost default.
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3....
0
votes
1
answer
2k
views
phpunit coverage-unit doesn't generate reports
Hi everybody,
i have some problem with phpunit coverage html component.
I installed correctly components and launch command:
vendor/bin/phpunit --coverage-html tests
Tests works correctly, but no html ...
1
vote
0
answers
905
views
PHPUnit with Clover code coverage reports: tests are not executed and commands exit
I "inherited" a very old PHP project compatible only with PHP 5.6 and written without any framework, and I'm trying to "modernize" it for PHP 7.x and adding some unit tests and some code inspection ...
1
vote
0
answers
49
views
How can i follow progression of code coverage
I currently use the php-code-coverage tool and i m wondering if there is a opensource tool to journalize the code-coverage day by day (or tests by tests)
I would like to track the progress or regress ...
0
votes
3
answers
1k
views
Laravel PHP unit with code coverage giving error PHPUnit\Framework\Exception: PHP Fatal error: Uncaught Error: Class 'Route' not found
I am getting following error
PHPUnit\Framework\Exception: PHP Fatal error: Uncaught Error: Class 'Route' not found in /var/www/html/checkout/routes/api.php:24
I have tried answer from Error: Class ...
0
votes
0
answers
219
views
How to make PHPUnit partially regenerate a code coverage HTML log
I'm using PHPUnit to generate code coverage data using the HTML logging type. Sometimes I'll generate a full coverage log across the whole codebase, and then rerun the tests with coverage on a smaller ...
1
vote
0
answers
30
views
How can I determine the code coverage of my unit tests?
I am trying to determine the code-coverage of a group of unit tests. How can I do this?
I have phpUnit and XDebug installed on my machine and from what I understand these tools will do the job but I ...
2
votes
3
answers
3k
views
PHP multiple function return types String|int [duplicate]
I've come across a bit unusual scenario where my function returns multiple types string or integer. I'm trying to declare return types. Could anyone please suggest me the best practice here to declare....
2
votes
2
answers
120
views
How to know if xdebug is right?
I'm running some tests and some reports don't make sense for example:
I also have another example:
Why xdebug marks 587 and 588 as not executed and 589 as executed?
3
votes
1
answer
277
views
PHPUnit code coverage reports false positive inside foreach
PHPUnit code coverage is reporting 100% coverage for the following function which is clearly wrong:
public function run(){
foreach ([1] as $value) {
if($value === 1 ){
...
3
votes
0
answers
185
views
Phpunit Code Coverage is not catching my code
I am trying to do phpunit testing using codeception and guzzle on my API written on php, all the tests are running but the codecoverage is always showing 0/0.
I am sharing my test function below
...
0
votes
0
answers
1k
views
Code coverage report is not generating
When run command phpunit --bootstrap="TestHelper.php" --coverage-clover coverage.xml --whitelist="../../../" --debug --log-junit result.xml ./
It generates result.xml but console get stuck after ...
1
vote
1
answer
1k
views
PHPUnit Mocked classes methods not shown as covered in code coverage reports?
I am working on a php project in magento2. I am using mock objects for writing unit test cases. I came to know that when i generate code coverage report, Mocked classes and methods do not show as ...
1
vote
1
answer
485
views
How to use the PHP_CodeCoverage library directly?
I'm trying to get the PHP_CodeCoverage library working for the simplest possible case to create an HTML code coverage report, and failing. I have PHP and Xdebug installed. I would rather not specify ...
1
vote
1
answer
622
views
How to setup Laravel Boilerplate phpunit to provide code coverage in Homestead environment
I have a fresh Laravel Boilerplate running on a Laravel Homestead environment which runs perfect.
The php -v command was returning me this info
PHP 7.1.2-3+deb.sury.org~xenial+1 (cli) (built: Feb 22 ...
1
vote
1
answer
696
views
Why Do PhpUnit dataProviders Lower Coverage Scores?
I have been using PhpUnit with good results, testing my code with assertions only. Recently I decided to try PhpUnit with coverage report analysis but I noticed that tests that use dataProvider ...
2
votes
2
answers
585
views
PHP Unit not working on Ubuntu 12.04 LTS with PHP5.6
Any one can help me to solve my problem. I want to run phpunit on php5.6 but got the issue
:~$ phpunit
PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or ...
1
vote
1
answer
3k
views
How to exclude a method from code coverage processing in PHP unit if you set processUncoveredFilesFromWhitelist="true"
I've set in my phpunit.xml to do the following:
<filter>
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
<directory suffix=".php"...
-1
votes
1
answer
610
views
PhpUnit code coverage html report is not getting created
I am running below command to create code coverage in html form
vendor/phpunit/phpunit/phpunit --whitelist --coverage-html tests
It is running but not creating code coverage report.
0
votes
0
answers
212
views
Reports get wrong links and cannot be found in Jenkins
In the build.xml of my Jenkins (PHP) project (hosted on a Windows Server) multiple reports are defined (PMD Warnings, Duplicate Code, JDepend, Checkstyle Warnings, Coverage Summary Report, ...
2
votes
1
answer
2k
views
How to get the PHP Code Coverage working with phpdbg on a Windows Server?
Since I still have troubles with PHPUnit / PHP Code Coverage and Xdebug, I decided to try it another way -- with phpdbg.
I did it as hier shown. Tried in CMD and also in Git Bash, but the result is ...