Permalink
Browse files

Resurrect addUncoveredFilesFromWhitelist configuration setting.

  • Loading branch information...
1 parent 50a5460 commit af633372258efb0b5a825d9badb840e6a2c5e295 @sebastianbergmann committed Oct 2, 2012
View
1 ChangeLog.md
@@ -7,6 +7,7 @@ PHPUnit 3.7.2
-------------
* Implemented #656: Always clean up mock objects (and free up memory).
+* Added the `addUncoveredFilesFromWhitelist` configuration setting back in.
* Disable token caching (in PHP_TokenStream, used by PHP_CodeCoverage) by default (to reduce memory footprint).
PHPUnit 3.7.1
View
6 PHPUnit/TextUI/TestRunner.php
@@ -256,6 +256,10 @@ public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
NULL, $this->codeCoverageFilter
);
+ $codeCoverage->setAddUncoveredFilesFromWhitelist(
+ $arguments['addUncoveredFilesFromWhitelist']
+ );
+
$codeCoverage->setProcessUncoveredFilesFromWhitelist(
$arguments['processUncoveredFilesFromWhitelist']
);
@@ -707,6 +711,7 @@ protected function handleConfiguration(array &$arguments)
extension_loaded('xdebug')) {
$filterConfiguration = $arguments['configuration']->getFilterConfiguration();
+ $arguments['addUncoveredFilesFromWhitelist'] = $filterConfiguration['whitelist']['addUncoveredFilesFromWhitelist'];
$arguments['processUncoveredFilesFromWhitelist'] = $filterConfiguration['whitelist']['processUncoveredFilesFromWhitelist'];
foreach ($filterConfiguration['blacklist']['include']['directory'] as $dir) {
@@ -751,6 +756,7 @@ protected function handleConfiguration(array &$arguments)
}
}
+ $arguments['addUncoveredFilesFromWhitelist'] = isset($arguments['addUncoveredFilesFromWhitelist']) ? $arguments['addUncoveredFilesFromWhitelist'] : TRUE;
$arguments['processUncoveredFilesFromWhitelist'] = isset($arguments['processUncoveredFilesFromWhitelist']) ? $arguments['processUncoveredFilesFromWhitelist'] : FALSE;
$arguments['backupGlobals'] = isset($arguments['backupGlobals']) ? $arguments['backupGlobals'] : NULL;
$arguments['backupStaticAttributes'] = isset($arguments['backupStaticAttributes']) ? $arguments['backupStaticAttributes'] : NULL;
View
31 PHPUnit/Util/Configuration.php
@@ -98,7 +98,8 @@
* <file>/path/to/file</file>
* </exclude>
* </blacklist>
- * <whitelist processUncoveredFilesFromWhitelist="false">
+ * <whitelist addUncoveredFilesFromWhitelist="true"
+ * processUncoveredFilesFromWhitelist="false">
* <directory suffix=".php">/path/to/files</directory>
* <file>/path/to/file</file>
* <exclude>
@@ -245,18 +246,29 @@ public function getFilename()
*/
public function getFilterConfiguration()
{
+ $addUncoveredFilesFromWhitelist = TRUE;
$processUncoveredFilesFromWhitelist = FALSE;
$tmp = $this->xpath->query('filter/whitelist');
- if ($tmp->length == 1 &&
- $tmp->item(0)->hasAttribute('processUncoveredFilesFromWhitelist')) {
- $processUncoveredFilesFromWhitelist = $this->getBoolean(
- (string)$tmp->item(0)->getAttribute(
- 'processUncoveredFilesFromWhitelist'
- ),
- FALSE
- );
+ if ($tmp->length == 1) {
+ if ($tmp->item(0)->hasAttribute('addUncoveredFilesFromWhitelist')) {
+ $addUncoveredFilesFromWhitelist = $this->getBoolean(
+ (string)$tmp->item(0)->getAttribute(
+ 'addUncoveredFilesFromWhitelist'
+ ),
+ TRUE
+ );
+ }
+
+ if ($tmp->item(0)->hasAttribute('processUncoveredFilesFromWhitelist')) {
+ $processUncoveredFilesFromWhitelist = $this->getBoolean(
+ (string)$tmp->item(0)->getAttribute(
+ 'processUncoveredFilesFromWhitelist'
+ ),
+ FALSE
+ );
+ }
}
return array(
@@ -279,6 +291,7 @@ public function getFilterConfiguration()
)
),
'whitelist' => array(
+ 'addUncoveredFilesFromWhitelist' => $addUncoveredFilesFromWhitelist,
'processUncoveredFilesFromWhitelist' => $processUncoveredFilesFromWhitelist,
'include' => array(
'directory' => $this->readFilterDirectories(
View
1 Tests/Util/ConfigurationTest.php
@@ -114,6 +114,7 @@ public function testFilterConfigurationIsReadCorrectly()
),
'whitelist' =>
array(
+ 'addUncoveredFilesFromWhitelist' => TRUE,
'processUncoveredFilesFromWhitelist' => FALSE,
'include' =>
array(
View
3 Tests/_files/configuration.xml
@@ -43,7 +43,8 @@
<file>/path/to/file</file>
</exclude>
</blacklist>
- <whitelist processUncoveredFilesFromWhitelist="false">
+ <whitelist addUncoveredFilesFromWhitelist="true"
+ processUncoveredFilesFromWhitelist="false">
<directory suffix=".php">/path/to/files</directory>
<file>/path/to/file</file>
<exclude>

0 comments on commit af63337

Please sign in to comment.