2
0

ErrorHandlerTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Test\Michel\Framework\Core;
  3. use Michel\Framework\Core\ErrorHandler\ErrorHandler;
  4. use Michel\UniTester\TestCase;
  5. class ErrorHandlerTest extends TestCase
  6. {
  7. protected function setUp(): void
  8. {
  9. // TODO: Implement setUp() method.
  10. }
  11. protected function tearDown(): void
  12. {
  13. // TODO: Implement tearDown() method.
  14. }
  15. protected function execute(): void
  16. {
  17. $this->testDeprecationErrors();
  18. }
  19. public function testDeprecationErrors()
  20. {
  21. $errorHandler = new ErrorHandler();
  22. $errorHandler->__invoke(E_USER_DEPRECATED, 'This is a deprecated error',__FILE__);
  23. $deprecations = $errorHandler->getDeprecations();
  24. $this->assertCount(1, $deprecations);
  25. $deprecation = $deprecations[0];
  26. $this->assertArrayHasKey('level', $deprecation);
  27. $this->assertEquals(E_USER_DEPRECATED, $deprecation['level']);
  28. $this->assertArrayHasKey('message', $deprecation);
  29. $this->assertEquals('This is a deprecated error', $deprecation['message']);
  30. }
  31. }