[ticket/13341] Change coverage to whitelist to prevent errors with temp ... #3146

Merged
merged 1 commit into from Nov 17, 2014

4 participants

@bantu
phpBB Forum Software member

...files.

b4f95de suggests that this can lead to issues
with classes having the same name. However, this does not seem to be a problem
with the current version of PHPUnit we are using.

Despite https://phpunit.de/manual/4.1/en/code-coverage-analysis.html saying
that addUncoveredFilesFromWhitelist="true" is optional, this seems to be on by
default in PHPUnit 4.1.0. As a result, all files are considered for code
coverage; which is what we want.

processUncoveredFilesFromWhitelist is however false (by default) and as such
even files that are considered for code coverage are not processed through PHP
when not used in actual tests. Since it is already impossible to test multiple
classes with the same name in the same test run (without process isolation),
because that would already lead to "cannot redeclare class" errors, it is also
impossible for "cannot redeclare class" errors to happen in test coverage.

PHPBB3-13341

https://tracker.phpbb.com/browse/PHPBB3-13341

@bantu bantu [ticket/13341] Change coverage to whitelist to prevent errors with te…
…mp files.


b4f95de suggests that this can lead to issues
with classes having the same name. However, this does not seem to be a problem
with the current version of PHPUnit we are using.

Despite https://phpunit.de/manual/4.1/en/code-coverage-analysis.html saying
that addUncoveredFilesFromWhitelist="true" is optional, this seems to be on by
default in PHPUnit 4.1.0. As a result, all files are considered for code
coverage; which is what we want.

processUncoveredFilesFromWhitelist is however false (by default) and as such
even files that are considered for code coverage are not processed through PHP
when not used in actual tests. Since it is already impossible to test multiple
classes with the same name in the same test run (without process isolation),
because that would already lead to "cannot redeclare class" errors, it is also
impossible for "cannot redeclare class" errors to happen in test coverage.

PHPBB3-13341
c40d7f0
@bantu
phpBB Forum Software member
@bantu bantu added the 3.0 (Olympus) label Nov 14, 2014
@Noxwizard
phpBB Forum Software member

@bantu That does allow the test to run with code coverage now. Is that going to generate the same coverage as before?

@bantu
phpBB Forum Software member

@Noxwizard I am not sure what the previous report looked like. I guess previous reports did not include any uncovered files. Adding those lead to "cannot redeclare class" errors with earlier versions of PHPUnit. I verified that this version includes uncovered files and no such errors are produced.

Furthermore, this is now consistent with what we have on develop-ascraeus (minus the /phpbb/ folder which we do not have on olympus). If I remember correctly, I also verified that #3147 did not change the generated report at all.

@Nicofuma Nicofuma modified the milestone: 3.0.13 Nov 16, 2014
@nickvergessen nickvergessen merged commit c40d7f0 into phpbb:develop-olympus Nov 17, 2014

1 check passed

Details continuous-integration/travis-ci The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment