diff --git a/ChangeLog-12.0.md b/ChangeLog-12.0.md index afe23a0ada4..0023d08bd10 100644 --- a/ChangeLog-12.0.md +++ b/ChangeLog-12.0.md @@ -6,6 +6,7 @@ All notable changes of the PHPUnit 12.0 release series are documented in this fi ### Removed +* [#5215](https://github.com/sebastianbergmann/phpunit/issues/5215): `TestCase::iniSet()` * [#5246](https://github.com/sebastianbergmann/phpunit/issues/5246): `TestCase::createTestProxy()` * [#5247](https://github.com/sebastianbergmann/phpunit/issues/5247): `TestCase::getMockForAbstractClass()` * [#5248](https://github.com/sebastianbergmann/phpunit/issues/5248): `TestCase::getMockFromWsdl()` diff --git a/DEPRECATIONS.md b/DEPRECATIONS.md index 8e3306c66da..6d93b95eac0 100644 --- a/DEPRECATIONS.md +++ b/DEPRECATIONS.md @@ -47,7 +47,6 @@ This functionality is currently [hard-deprecated](https://phpunit.de/backward-co | Issue | Description | Since | Replacement | |-------------------------------------------------------------------|-------------------------------------------------------------|--------|-----------------------------------------------------------------------------------------| | [#4505](https://github.com/sebastianbergmann/phpunit/issues/4505) | Metadata in doc-comments | 10.3.0 | Metadata in attributes | -| [#5214](https://github.com/sebastianbergmann/phpunit/issues/5214) | `TestCase::iniSet()` | 10.3.0 | | | [#5216](https://github.com/sebastianbergmann/phpunit/issues/5216) | `TestCase::setLocale()` | 10.3.0 | | | [#5800](https://github.com/sebastianbergmann/phpunit/issues/5800) | Targeting traits with `#[CoversClass]` and `#[UsesClass]` | 11.2.0 | `#[CoversClass]` and `#[UsesClass]` also target the traits used by the targeted classes | | [#5951](https://github.com/sebastianbergmann/phpunit/issues/5951) | `includeUncoveredFiles` configuration option | 11.4.0 | | diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index 2d9d8f6b5b3..65e58f5e17d 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -31,7 +31,6 @@ use function getcwd; use function implode; use function in_array; -use function ini_set; use function is_array; use function is_callable; use function is_int; @@ -176,11 +175,6 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T */ private array $dependencyInput = []; - /** - * @var array - */ - private array $iniSettings = []; - /** * @var array */ @@ -645,7 +639,6 @@ final public function runBare(): void $this->restoreGlobalErrorExceptionHandlers(); $this->restoreGlobalState(); $this->unregisterCustomComparators(); - $this->cleanupIniSettings(); $this->cleanupLocaleSettings(); libxml_clear_errors(); @@ -1241,39 +1234,6 @@ final protected function runTest(): mixed return $testResult; } - /** - * This method is a wrapper for the ini_set() function that automatically - * resets the modified php.ini setting to its original value after the - * test is run. - * - * @throws Exception - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5214 - * - * @codeCoverageIgnore - */ - final protected function iniSet(string $varName, string $newValue): void - { - Event\Facade::emitter()->testTriggeredPhpunitDeprecation( - $this->valueObjectForEvents(), - 'iniSet() is deprecated and will be removed in PHPUnit 12 without replacement.', - ); - - $currentValue = ini_set($varName, $newValue); - - if ($currentValue !== false) { - $this->iniSettings[$varName] = $currentValue; - } else { - throw new Exception( - sprintf( - 'INI setting "%s" could not be set to "%s".', - $varName, - $newValue, - ), - ); - } - } - /** * This method is a wrapper for the setlocale() function that automatically * resets the locale to its original value after the test is run. @@ -1959,15 +1919,6 @@ private function unregisterCustomComparators(): void $this->customComparators = []; } - private function cleanupIniSettings(): void - { - foreach ($this->iniSettings as $varName => $oldValue) { - ini_set($varName, $oldValue); - } - - $this->iniSettings = []; - } - private function cleanupLocaleSettings(): void { foreach ($this->locale as $category => $locale) {