public function endTest(\PHPUnit_Framework_Test $test, $time) { if ($this->expectedDeprecations) { restore_error_handler(); try { $prefix = "@expectedDeprecation:\n "; $test->assertStringMatchesFormat($prefix . implode("\n ", $this->expectedDeprecations), $prefix . implode("\n ", $this->gatheredDeprecations)); } catch (\PHPUnit_Framework_AssertionFailedError $e) { $test->getTestResultObject()->addFailure($test, $e, $time); } $this->expectedDeprecations = $this->gatheredDeprecations = $this->previousErrorHandler = null; } if (-2 < $this->state && $test instanceof \PHPUnit_Framework_TestCase) { $groups = \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName(false)); if (in_array('time-sensitive', $groups, true)) { ClockMock::withClockMock(false); } if (in_array('dns-sensitive', $groups, true)) { DnsMock::withMockedHosts(array()); } } }