mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-01 15:14:11 +01:00
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:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user