Skip to content

Commit 008de64

Browse files
committed
TestCase: use PHP 5.4 features
1 parent cb1a877 commit 008de64

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/Framework/TestCase.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,16 @@ public function runTest($method, array $args = NULL)
114114

115115

116116
if ($this->prevErrorHandler === FALSE) {
117-
$me = $this;
118-
$handleErrors = & $this->handleErrors;
119-
$prev = & $this->prevErrorHandler;
120-
121-
$prev = set_error_handler(function ($severity) use ($me, & $prev, & $handleErrors) {
122-
if ($handleErrors && ($severity & error_reporting()) === $severity) {
123-
$handleErrors = FALSE;
124-
$rm = new \ReflectionMethod($me, 'tearDown');
125-
$rm->setAccessible(TRUE);
117+
$this->prevErrorHandler = set_error_handler(function ($severity) {
118+
if ($this->handleErrors && ($severity & error_reporting()) === $severity) {
119+
$this->handleErrors = FALSE;
126120

127121
set_error_handler(function() {}); // mute all errors
128-
$rm->invoke($me);
122+
$this->tearDown();
129123
restore_error_handler();
130124
}
131125

132-
return $prev ? call_user_func_array($prev, func_get_args()) : FALSE;
126+
return $this->prevErrorHandler ? call_user_func_array($this->prevErrorHandler, func_get_args()) : FALSE;
133127
});
134128
}
135129

0 commit comments

Comments
 (0)