<?php use Codeception\Event\SuiteEvent; use Codeception\Lib\Notification; use Codeception\Subscriber\ErrorHandler; use Codeception\Suite; class ErrorHandlerTest extends \PHPUnit\Framework\TestCase { public function testDeprecationMessagesRespectErrorLevelSetting() { $errorHandler = new ErrorHandler(); $suiteEvent = new SuiteEvent(new Suite(), null, ['error_level' => 'E_ERROR']); $errorHandler->handle($suiteEvent); //Satisfying The Premature Exit Handling $errorHandler->onFinish($suiteEvent); Notification::all(); //clear the messages $errorHandler->errorHandler(E_USER_DEPRECATED, 'deprecated message', __FILE__, __LINE__, []); $this->assertEquals([], Notification::all(), 'Deprecation message was added to notifications'); } }