I've refactored some code and introduced deprecation warnings with trigger_error()
and the E_USER_DEPRECATED
constant.
Therefore I needed to modify the test that is touching that feature
public function testMethod()
{
$expected = 'value';
$actual = $this->subject->callDeprecatedMethod();
$this->assertEquals($expected, $actual)
}
So that the method call does not raise the exception (e.g. as outlined here or here):
public function testMethod()
{
$expected = 'value';
$save = PHPUnit_Framework_Error_Deprecated::$enabled;
PHPUnit_Framework_Error_Deprecated::$enabled = false;
$actual = $this->subject->callDeprecatedMethod();
PHPUnit_Framework_Error_Deprecated::$enabled = save;
$this->assertEquals($expected, $actual)
}
This worked fine, however I realized that when running all tests, the testrunner took much much longer at one dot suddenly and by checking against JSON and also in PHPStorm that for this just changed testMethod
the timings went up from milliseconds to 0.71 seconds.
How can I prevent this?
I need my tests to run fast fast fast :)