ErrorLoggerTest.php 859 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Tools\Test\TestCase\ErrorHandler;
  3. use Cake\Http\Exception\InternalErrorException;
  4. use Cake\Http\Exception\NotFoundException;
  5. use Shim\TestSuite\TestCase;
  6. use Shim\TestSuite\TestTrait;
  7. use Tools\Error\ErrorLogger;
  8. class ErrorLoggerTest extends TestCase {
  9. use TestTrait;
  10. /**
  11. * @var \Tools\Error\ExceptionTrap
  12. */
  13. protected $errorLogger;
  14. /**
  15. * @return void
  16. */
  17. public function setUp(): void {
  18. parent::setUp();
  19. $this->errorLogger = new ErrorLogger();
  20. }
  21. /**
  22. * @return void
  23. */
  24. public function testIs404(): void {
  25. $exception = new NotFoundException();
  26. $result = $this->invokeMethod($this->errorLogger, 'is404', [$exception]);
  27. $this->assertTrue($result);
  28. $exception = new InternalErrorException();
  29. $result = $this->invokeMethod($this->errorLogger, 'is404', [$exception]);
  30. $this->assertFalse($result);
  31. }
  32. }