Skip to content

Commit

Permalink
Merge pull request #183 from City-of-Helsinki/UHF-10844-sentry-logging
Browse files Browse the repository at this point in the history
UHF-10844 & UHF-10842: Add raven monolog logger
  • Loading branch information
hyrsky authored Oct 28, 2024
2 parents 77ba93f + 74e1c33 commit 386c2ad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/HelfiApiBaseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function register(ContainerBuilder $container) : void {
'name' => 'default_conditional_handler',
'formatter' => 'drush_or_json',
],
[
'name' => 'drupal.raven',
'processors' => ['current_user', 'request_uri', 'ip', 'referer'],
],
],
],
]);
Expand Down
8 changes: 4 additions & 4 deletions tests/src/Unit/Commands/PubSubCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
use Drupal\helfi_api_base\Azure\PubSub\PubSubManagerInterface;
use Drupal\helfi_api_base\Drush\Commands\PubSubCommands;
use Drush\Commands\DrushCommands;
use Drush\Style\DrushStyle;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use WebSocket\ConnectionException;
use WebSocket\TimeoutException;

Expand All @@ -31,7 +31,7 @@ public function testListen() : void {
$expectedMessage = '{"message":"test"}';
$output = $this->prophesize(OutputInterface::class);
$input = $this->prophesize(InputInterface::class);
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->writeln(Argument::containingString('Received message'))
->shouldBeCalledTimes(PubSubCommands::MAX_MESSAGES);
$io->writeln(Argument::containingString('Received maximum number of messages'))
Expand All @@ -51,7 +51,7 @@ public function testListen() : void {
public function testExceptionOutput() : void {
$output = $this->prophesize(OutputInterface::class);
$input = $this->prophesize(InputInterface::class);
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->writeln('Invalid json: Syntax error')->shouldBeCalledTimes(PubSubCommands::MAX_MESSAGES);
$io->writeln(Argument::containingString('Received maximum number of messages'))
->shouldBeCalledTimes(1);
Expand All @@ -70,7 +70,7 @@ public function testExceptionOutput() : void {
public function testTimeoutException() : void {
$output = $this->prophesize(OutputInterface::class);
$input = $this->prophesize(InputInterface::class);
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->writeln(Argument::containingString('Received maximum number of messages'))
->shouldBeCalledTimes(1);

Expand Down
10 changes: 5 additions & 5 deletions tests/src/Unit/Commands/RevisionCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
use Drupal\helfi_api_base\Commands\RevisionCommands;
use Drupal\helfi_api_base\Entity\Revision\RevisionManager;
use Drush\Commands\DrushCommands;
use Drush\Style\DrushStyle;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

/**
* Tests revision commands.
Expand Down Expand Up @@ -114,7 +114,7 @@ private function getConnectionMock(array $expected, ?int $id = NULL) : Connectio
* Test command with invalid entity type.
*/
public function testInvalidEntityType() : void {
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->writeln(Argument::containingString('Given entity type is not supported.'))
->shouldBeCalled();

Expand All @@ -130,7 +130,7 @@ public function testInvalidEntityType() : void {
* Test delete without any entities.
*/
public function testNoEntities() : void {
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->isDecorated()
->willReturn(TRUE);
$io->getVerbosity()
Expand All @@ -148,7 +148,7 @@ public function testNoEntities() : void {
* Tests delete method with proper data.
*/
public function testDelete() : void {
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->isDecorated()
->willReturn(TRUE);
$io->getVerbosity()
Expand All @@ -170,7 +170,7 @@ public function testDelete() : void {
* Tests delete method with optional ID.
*/
public function testDeleteWithId() : void {
$io = $this->prophesize(SymfonyStyle::class);
$io = $this->prophesize(DrushStyle::class);
$io->isDecorated()
->willReturn(TRUE);
$io->getVerbosity()
Expand Down

0 comments on commit 386c2ad

Please sign in to comment.