Skip to content

Commit

Permalink
Closes #5215
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 6, 2024
1 parent 4b851e1 commit 8d269d2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 50 deletions.
1 change: 1 addition & 0 deletions ChangeLog-12.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Expand Down
1 change: 0 additions & 1 deletion DEPRECATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | |
Expand Down
49 changes: 0 additions & 49 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -176,11 +175,6 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T
*/
private array $dependencyInput = [];

/**
* @var array<string,string>
*/
private array $iniSettings = [];

/**
* @var array<int, non-empty-string>
*/
Expand Down Expand Up @@ -645,7 +639,6 @@ final public function runBare(): void
$this->restoreGlobalErrorExceptionHandlers();
$this->restoreGlobalState();
$this->unregisterCustomComparators();
$this->cleanupIniSettings();
$this->cleanupLocaleSettings();
libxml_clear_errors();

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 8d269d2

Please sign in to comment.