=')) { $this->expectWarning(); $sUndefinedOffsetExceptionMessage = 'Undefined array key "tutu"'; } else { $this->expectNotice(); $sUndefinedOffsetExceptionMessage = 'Undefined index: tutu'; } $this->expectExceptionMessage($sUndefinedOffsetExceptionMessage); } public function testPhpNoticeWithoutDeprecatedCallsLog(): void { $this->SetUndefinedOffsetExceptionToExpect(); $aArray = []; if ('toto' === $aArray['tutu']) { //Do nothing, just raising a undefined offset warning } } /** * @runInSeparateProcess Necessary, due to the DeprecatedCallsLog being enabled (no mean to reset) * * The error handler set by DeprecatedCallsLog during startup was causing PHPUnit to miss PHP notices like "undefined offset" * * The error handler is now disabled when running PHPUnit * * @since 3.0.4 N°6274 * @covers DeprecatedCallsLog::DeprecatedNoticesErrorHandler */ public function testPhpNoticeWithDeprecatedCallsLog(): void { $this->RequireOnceItopFile('core/log.class.inc.php'); DeprecatedCallsLog::Enable(); // will set error handler $this->SetUndefinedOffsetExceptionToExpect(); $aArray = []; if ('toto' === $aArray['tutu']) { //Do nothing, just raising a undefined offset warning } } }