You are here

protected function PHPUnit_Framework_TestCase::iniSet in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/TestCase.php \PHPUnit_Framework_TestCase::iniSet()

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.

@since Method available since Release 3.0.0

Parameters

string $varName:

string $newValue:

Throws

PHPUnit_Framework_Exception

2 calls to PHPUnit_Framework_TestCase::iniSet()
Issue578Test::testNoticesDoublePrintStackTrace in vendor/phpunit/phpunit/tests/Regression/578/Issue578Test.php
Issue578Test::testWarningsDoublePrintStackTrace in vendor/phpunit/phpunit/tests/Regression/578/Issue578Test.php

File

vendor/phpunit/phpunit/src/Framework/TestCase.php, line 1199

Class

PHPUnit_Framework_TestCase
A TestCase defines the fixture to run multiple tests.

Code

protected function iniSet($varName, $newValue) {
  if (!is_string($varName)) {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
  }
  $currentValue = ini_set($varName, $newValue);
  if ($currentValue !== false) {
    $this->iniSettings[$varName] = $currentValue;
  }
  else {
    throw new PHPUnit_Framework_Exception(sprintf('INI setting "%s" could not be set to "%s".', $varName, $newValue));
  }
}