Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-10844 & UHF-10842: Add raven monolog logger #183

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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