mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
N°6274 DeprecatedCallsLogTest : replace expectException deprecated calls
Message was : Support for using expectException() with PHPUnit\Framework\Error\Warning is deprecated and will be removed in PHPUnit 10. Use expectWarning() instead.
This commit is contained in:
@@ -9,8 +9,6 @@ namespace Combodo\iTop\Test\UnitTest\Core\Log;
|
||||
|
||||
use Combodo\iTop\Test\UnitTest\ItopTestCase;
|
||||
use DeprecatedCallsLog;
|
||||
use PHPUnit\Framework\Error\Notice;
|
||||
use PHPUnit\Framework\Error\Warning;
|
||||
|
||||
class DeprecatedCallsLogTest extends ItopTestCase {
|
||||
/**
|
||||
@@ -19,15 +17,15 @@ class DeprecatedCallsLogTest extends ItopTestCase {
|
||||
* @link https://www.php.net/manual/en/migration80.incompatible.php check "A number of notices have been converted into warnings:"
|
||||
*/
|
||||
private function SetUndefinedOffsetExceptionToExpect(): void {
|
||||
if (version_compare(phpversion(), '8.0', '>=')) {
|
||||
$sUndefinedOffsetExceptionClass = Warning::class;
|
||||
/** @noinspection ConstantCanBeUsedInspection Preferring the function call as it is easier to read and won't cost that much in this PHPUnit context */
|
||||
if (version_compare(PHP_VERSION, '8.0', '>=')) {
|
||||
$this->expectWarning();
|
||||
$sUndefinedOffsetExceptionMessage = 'Undefined array key "tutu"';
|
||||
}
|
||||
else {
|
||||
$sUndefinedOffsetExceptionClass = Notice::class;
|
||||
$this->expectNotice();
|
||||
$sUndefinedOffsetExceptionMessage = 'Undefined index: tutu';
|
||||
}
|
||||
$this->expectException($sUndefinedOffsetExceptionClass);
|
||||
$this->expectExceptionMessage($sUndefinedOffsetExceptionMessage);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user