-
-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support XDEBUG_MODE environment variable #834
Comments
|
From reading
I understand that Xdebug looks at the For a short term solution, this library can fall back to looking for/at the if (!ini_get('xdebug.mode') || !in_array('coverage', explode(',', ini_get('xdebug.mode')), true)) {
throw new Xdebug3NotEnabledException;
} The message of In the long run, though, I would really like for Xdebug to provide a function that returns information about which mode(s) is/are currently active. |
Created https://bugs.xdebug.org/view.php?id=1898 for tracking my feature request for Xdebug. |
Is this supposed to work when configuring the xdebug variable via Because if so, then the file below is not working: it's not generating reporting and showing me the warning mentioned in the issue. <?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1" />
<ini name="xdebug.mode" value="coverage" />
<env name="XDEBUG_MODE" value="coverage" />
</php>
<testsuites>
<testsuite name="Main Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
<report>
<clover outputFile="./reports/coverage_clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="reports/junit.xml"/>
</logging>
</phpunit> Version code coverage: phpunit/php-code-coverage (9.2.5) calling in the way described in the issue |
No, this cannot work when |
@sebastianbergmann thanks for clarify it. |
Support for XDEBUG_MODE environment variable was introduced in php-code-coverage at version 9.2.4. sebastianbergmann/php-code-coverage#834 PHPUnit 9.4 requires php-code-coverage^9.2
XDEBUG_MODE needs to be set to coverage on the command to run phpunit. This either can be passed in the command to run or placed in the php.ini file. Solution discussed on issue sebastianbergmann/php-code-coverage#834
關聯的失敗 job - https://travis-ci.org/github/CQD/qlurk/jobs/753770091 關聯的 phpunit issue - sebastianbergmann/php-code-coverage#834
關聯的失敗 job - https://travis-ci.org/github/CQD/qlurk/jobs/753770091 關聯的 phpunit issue - sebastianbergmann/php-code-coverage#834
關聯的失敗 job - https://travis-ci.org/github/CQD/qlurk/jobs/753770091 關聯的 phpunit issue - sebastianbergmann/php-code-coverage#834
After switching to xdebug v3 in 325974c, PHPUnit stopped creating coverage reports and began emitting the following warning: > XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set We set this as an environment variable in the `smr-integration-test` service to re-enable coverage reports. See sebastianbergmann/php-code-coverage#834.
As a Composer script, you can use "test:coverage": [
"@putenv XDEBUG_MODE=coverage",
"phpunit --color=always --coverage-clover=\"output/code-coverage/clover.xml\""
],
"test:coverage-html": [
"@putenv XDEBUG_MODE=coverage",
"phpunit --color=always --coverage-html=\"output/code-coverage\""
],
|
Based on discussion from sebastianbergmann/php-code-coverage#834
* Put libertempo in lowercase to solve a warning from composer * Add a description * Global version update * Update php version to 7.4 * Update php version to 7.4 * Rollback to php 7.2 * Rollback to php 7.1 * Update to php 7.3 for travis * Correct the channel property for irc * Update to php-code-coverage 9.2.6 because of sebastianbergmann/php-code-coverage#834 * Only notify IRC on the main repo, not on clones * Move to php 7.4 to enable test coverage * Upgrade atoum to 3.4.1 for compatibility on travis-ci * Set the exact version * Check if the fetch_array returns something before checking the value
xdebug.mode=coverage has to be set in php.ini |
Summary
PHPUnit only understands Xdebug modes set in
php.ini
when checking for coverage availability.When running:
It is not recognised that the mode is set.
Current behavior
PHPUnit shows a warning:
How to reproduce
vendor/bin/phpunit
.XDEBUG_MODE=coverage php -n -dzend_extension=xdebug vendor/bin/phpunit --coverage-text
Expected behavior
Code coverage should have been run, as it would have been with:
The text was updated successfully, but these errors were encountered: