Skip to content
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

Circular dependency coverage issue #579

Closed
jaapio opened this issue Jan 17, 2018 · 2 comments
Closed

Circular dependency coverage issue #579

jaapio opened this issue Jan 17, 2018 · 2 comments

Comments

@jaapio
Copy link

jaapio commented Jan 17, 2018

Q A
php-code-coverage version latest
PHP version 7.1
Driver Xdebug
Xdebug version (if used) 2.*
Installation Method PHPUnit PHAR
Usage Method PHPUnit
PHPUnit version (if used) 6.5

I'm not sure if this is an fixable issue and if this is the right project to post this issue.

We (@phpDocumentor team) are using phpunit to test our own code base. phpunit itself is using phpdocumentor/reflection-docblock via phpspec/prophecy. This results in to a circular dependency. Lucky enough composer is smart enough to resolve all those dependencies without issues. And phpspec/prophecy supports many versions of our phpdocumentor/reflection-docblock package.

To break with all these dependencies and make it easier for our users to install phpdocumentor via composer we are trying to get rid of phpunit as a composer dependency. And install it via phive.
However we have some issues when collecting code coverage. Simply no coverage was collected.
When we started thinking about how this could work we realized that this might be a limitation how phpunit and code coverage actually works. Since the phar contains our package php can only autoload one of the classes. Probably from the phar? So non of the classes of the tested package are loaded by php. Which leads to zero coverage?

Since php can only load a single class I expect this to be a limitation of php? However there are packages that are trying to prefix the classes in the phar to ensure the class names are unique.

Do you know a work around for this issue?

@ashnazg
Copy link
Contributor

ashnazg commented Jan 17, 2018

Easiest way to duplicate this is to clone ReflectionCommon and run its testsuite using the current phpunit.phar from phar.phpunit.de.

@sebastianbergmann
Copy link
Owner

When you use PHPUnit from a PHAR then the sources bundled in the PHAR have precedence, yes.

The solution to this problem will be sebastianbergmann/phpunit#2015.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants