ErrorHandlerTest.php 816 B

123456789101112131415161718192021222324252627
  1. <?php
  2. use Codeception\Event\SuiteEvent;
  3. use Codeception\Lib\Notification;
  4. use Codeception\Subscriber\ErrorHandler;
  5. use Codeception\Suite;
  6. class ErrorHandlerTest extends \PHPUnit\Framework\TestCase
  7. {
  8. public function testDeprecationMessagesRespectErrorLevelSetting()
  9. {
  10. $errorHandler = new ErrorHandler();
  11. $suiteEvent = new SuiteEvent(new Suite(), null, ['error_level' => 'E_ERROR']);
  12. $errorHandler->handle($suiteEvent);
  13. //Satisfying The Premature Exit Handling
  14. $errorHandler->onFinish($suiteEvent);
  15. Notification::all(); //clear the messages
  16. $errorHandler->errorHandler(E_USER_DEPRECATED, 'deprecated message', __FILE__, __LINE__, []);
  17. $this->assertEquals([], Notification::all(), 'Deprecation message was added to notifications');
  18. }
  19. }