Skip to content

Commit

Permalink
Using the context level logger in a message handler
Browse files Browse the repository at this point in the history
  • Loading branch information
desperado committed Jan 15, 2020
1 parent 4a6db29 commit e0bf54b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function do(TestBootstrapCommand $command, ServiceBusContext $context): v
/**
* @EventListener()
*/
public function when(TestBootstrapEvent $event, ServiceBusContext $context): void
public function when(TestBootstrapEven $event, ServiceBusContext $context): void
{
}
}
4 changes: 1 addition & 3 deletions tests/EntryPoint/EntryPointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
use ServiceBus\Services\Configuration\ServiceMessageHandler;
use ServiceBus\Transport\Common\Queue;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use function Amp\delay;
use function ServiceBus\Tests\filterLogMessages;

/**
Expand Down Expand Up @@ -77,8 +76,7 @@ protected function setUp(): void
new MessageArgumentResolver(),
new ContextArgumentResolver(),
new ContainerArgumentResolver($containerBuilder)
],
$this->logger
]
);

$messageRouter = new Router();
Expand Down
15 changes: 7 additions & 8 deletions tests/MessageExecutor/DefaultMessageExecutorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,16 @@ static function () use (&$variable): void
$closure,
new \SplObjectStorage(),
DefaultHandlerOptions::createForCommandHandler('some description'),
$this->argumentResolvers,
$this->logger
$this->argumentResolvers
);

wait($processor(new EmptyMessage(), new TestContext()));
$context = new TestContext();

wait($processor(new EmptyMessage(), $context));

static::assertSame('handled', $variable);

$messages = filterLogMessages($this->logHandler);
$messages = filterLogMessages($context->testLogHandler);

static::assertContains('some description', $messages);
}
Expand All @@ -102,8 +103,7 @@ static function (): void
$closure,
new \SplObjectStorage(),
$options,
$this->argumentResolvers,
$this->logger
$this->argumentResolvers
);

wait($processor(new EmptyMessage(), $context));
Expand Down Expand Up @@ -133,8 +133,7 @@ static function (): void
$closure,
new \SplObjectStorage(),
DefaultHandlerOptions::createForCommandHandler('some description'),
$this->argumentResolvers,
$this->logger
$this->argumentResolvers
);

wait($processor(new EmptyMessage(), new TestContext()));
Expand Down
9 changes: 3 additions & 6 deletions tests/MessageExecutor/MessageValidationExecutorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ static function (): void
$closure,
new \SplObjectStorage(),
$options,
$this->argumentResolvers,
$this->logger
$this->argumentResolvers
),
$options,
$this->validator
Expand Down Expand Up @@ -127,8 +126,7 @@ static function (): void
$closure,
new \SplObjectStorage(),
$options,
$this->argumentResolvers,
$this->logger
$this->argumentResolvers
),
$options,
$this->validator
Expand Down Expand Up @@ -165,8 +163,7 @@ static function (): void
$closure,
new \SplObjectStorage(),
$options,
$this->argumentResolvers,
$this->logger
$this->argumentResolvers
),
$options,
$this->validator
Expand Down

0 comments on commit e0bf54b

Please sign in to comment.