N°4224 remove workarounds for DEPRECATED notices generated by mock

We shouldn't have the problem anymore with PHPUnit 8.5 !
This commit is contained in:
Pierre Goiffon
2022-05-05 15:43:59 +02:00
parent b3ef9333af
commit bab14e1489
3 changed files with 0 additions and 41 deletions

View File

@@ -34,10 +34,6 @@ class UserLocalTest extends ItopDataTestCase
*/
public function testValidatePassword($sPassword, $aValidatorNames, $aConfigValueMap, $bExpectedCheckStatus, $expectedCheckIssues = null, $sUserLanguage = null)
{
// We are calling methods that generates DEPRECATED warnings :( Like PHPUnit\Framework\MockObject\Generator::generateMock
// Since N°3002 this would make the test fail, so this is a workaround !
// changing ways to do mock will be done in N°4224
set_error_handler(array(__CLASS__, 'VoidErrorHandlerForDeprecated'));
$configMock = $this->createMock(\Config::class);
$configMock
->method('GetModuleSetting')
@@ -74,28 +70,6 @@ class UserLocalTest extends ItopDataTestCase
}
}
/**
* Fake error handler to silently discard DEPRECATED warnings
*
* @param int $iErrNo
* @param string $sErrStr
* @param string $sErrFile
* @param int $iErrLine
*
* @return boolean
*/
public static function VoidErrorHandlerForDeprecated($iErrno, $sErrStr, $sErrFile, $iErrLine)
{
if (
(\E_USER_DEPRECATED !== $iErrno)
&& (\E_DEPRECATED !== $iErrno)
) {
return false;
}
return true; // Ignore the error
}
public function ProviderValidatePassword()
{
return array(
@@ -262,7 +236,6 @@ class UserLocalTest extends ItopDataTestCase
);
}
/**
* @dataProvider ProviderPasswordRenewal
*