Skip to content

Commit c073c91

Browse files
committed
Use PHPUnit ini_set wrapper in tests
PHPUnit ini_set wrapper is now used in tests to automatically reset ini settings after the test is run. This avoids possible side effects and test skipping. Native ini_set is still used in DefaultCsrfProviderTest, but its tests are run in isolation.
1 parent 95a6c1c commit c073c91

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Tests/EventListener/ExceptionListenerTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ public function testConstruct()
5656
*/
5757
public function testHandleWithoutLogger($event, $event2)
5858
{
59-
// store the current error_log, and disable it temporarily
60-
$errorLog = ini_set('error_log', file_exists('/dev/null') ? '/dev/null' : 'nul');
59+
$this->iniSet('error_log', file_exists('/dev/null') ? '/dev/null' : 'nul');
6160

6261
$l = new ExceptionListener('foo');
6362
$l->onKernelException($event);
@@ -69,9 +68,6 @@ public function testHandleWithoutLogger($event, $event2)
6968
} catch (\Exception $e) {
7069
$this->assertSame('foo', $e->getMessage());
7170
}
72-
73-
// restore the old error_log
74-
ini_set('error_log', $errorLog);
7571
}
7672

7773
/**

0 commit comments

Comments
 (0)