Skip to content

Commit

Permalink
More work on removing the blacklist/whitelist terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jun 7, 2020
1 parent b4e0791 commit 7b3fdaf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ChangeLog-9.3.md
Expand Up @@ -7,6 +7,8 @@ All notable changes of the PHPUnit 9.3 release series are documented in this fil
### Changed

* [#4264](https://github.com/sebastianbergmann/phpunit/pull/4264): Refactor logical operator constraints
* `PHPUnit\Framework\TestCase::$backupGlobalsBlacklist` is deprecated, use `PHPUnit\Framework\TestCase::$backupGlobalsExcludeList` instead
* `PHPUnit\Framework\TestCase::$backupStaticAttributesBlacklist` is deprecated, use `PHPUnit\Framework\TestCase::$backupStaticAttributesExcludeList` instead
* `PHPUnit\Util\Blacklist` is now deprecated, please use `PHPUnit\Util\ExcludeList` instead

[9.3.0]: https://github.com/sebastianbergmann/phpunit/compare/9.2...master
24 changes: 24 additions & 0 deletions src/Framework/TestCase.php
Expand Up @@ -68,6 +68,13 @@ abstract class TestCase extends Assert implements SelfDescribing, Test
/**
* @var string[]
*/
protected $backupGlobalsExcludeList = [];

/**
* @var string[]
*
* @deprecated Use $backupGlobalsExcludeList instead
*/
protected $backupGlobalsBlacklist = [];

/**
Expand All @@ -78,6 +85,13 @@ abstract class TestCase extends Assert implements SelfDescribing, Test
/**
* @var array<string,array<int,string>>
*/
protected $backupStaticAttributesExcludeList = [];

/**
* @var array<string,array<int,string>>
*
* @deprecated Use $backupStaticAttributesExcludeList instead
*/
protected $backupStaticAttributesBlacklist = [];

/**
Expand Down Expand Up @@ -2167,6 +2181,10 @@ private function createGlobalStateSnapshot(bool $backupGlobals): Snapshot
{
$excludeList = new ExcludeList;

foreach ($this->backupGlobalsExcludeList as $globalVariable) {
$excludeList->addGlobalVariable($globalVariable);
}

foreach ($this->backupGlobalsBlacklist as $globalVariable) {
$excludeList->addGlobalVariable($globalVariable);
}
Expand All @@ -2183,6 +2201,12 @@ private function createGlobalStateSnapshot(bool $backupGlobals): Snapshot
$excludeList->addClassNamePrefix('Doctrine\Instantiator');
$excludeList->addClassNamePrefix('Prophecy');

foreach ($this->backupStaticAttributesExcludeList as $class => $attributes) {
foreach ($attributes as $attribute) {
$excludeList->addStaticAttribute($class, $attribute);
}
}

foreach ($this->backupStaticAttributesBlacklist as $class => $attributes) {
foreach ($attributes as $attribute) {
$excludeList->addStaticAttribute($class, $attribute);
Expand Down

0 comments on commit 7b3fdaf

Please sign in to comment.