Skip to content

Commit

Permalink
Restore rollbar test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Nov 11, 2024
1 parent 55a7b33 commit 7b5a792
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"phpstan/phpstan-strict-rules": "^1.4",
"phpunit/phpunit": "^10.5.17",
"predis/predis": "^1.1 || ^2",
"rollbar/rollbar": "^4.0",
"ruflin/elastica": "^7 || ^8",
"symfony/mailer": "^5.4 || ^6",
"symfony/mime": "^5.4 || ^6"
Expand Down
3 changes: 0 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ parameters:
paths:
- src/Monolog/Formatter/LineFormatter.php

# can be removed when rollbar/rollbar can be added as dev require again (needs to allow monolog 3.x)
- '#Rollbar\\RollbarLogger#'

includes:
- phpstan-baseline.neon
- phpstan-ignore-by-php-version.neon.php
Expand Down
1 change: 0 additions & 1 deletion src/Monolog/Handler/RollbarHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ protected function write(LogRecord $record): void
$toLog = $record->message;
}

// @phpstan-ignore-next-line
$this->rollbarLogger->log($context['level'], $toLog, $context);

$this->hasRecords = true;
Expand Down
10 changes: 2 additions & 8 deletions tests/Monolog/Handler/RollbarHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ public function testExceptionLogLevel()
{
$handler = $this->createHandler();

$handler->handle($this->createExceptionRecord(Level::Debug));
$handler->handle($this->getRecord(Level::Debug, context: ['exception' => $e = new Exception()]));

$this->assertEquals('debug', $this->reportedExceptionArguments['payload']['level']);
$this->assertSame($e, $this->reportedExceptionArguments['context']);
}

private function setupRollbarLoggerMock()
Expand All @@ -82,11 +83,4 @@ private function createHandler(): RollbarHandler
{
return new RollbarHandler($this->rollbarLogger, Level::Debug);
}

private function createExceptionRecord($level = Level::Debug, $message = 'test', $exception = null): array
{
return $this->getRecord($level, $message, [
'exception' => $exception ?: new Exception(),
]);
}
}

0 comments on commit 7b5a792

Please sign in to comment.