Skip to content

Commit

Permalink
replace logger definition
Browse files Browse the repository at this point in the history
  • Loading branch information
mmasiukevich committed Apr 5, 2022
1 parent 82a1bbf commit 00751ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/Module/EventSourcingModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace ServiceBus\EventSourcing\Module;

use Psr\Log\LoggerInterface;
use ServiceBus\Common\Module\ServiceBusModule;
use ServiceBus\EventSourcing\EventSourcingProvider;
use ServiceBus\EventSourcing\EventStream\EventStreamRepository;
Expand Down Expand Up @@ -168,7 +169,7 @@ private function registerEventSourcingProvider(ContainerBuilder $containerBuilde
new Reference(Snapshotter::class),
new Reference(ObjectDenormalizer::class),
$serializer,
new Reference('service_bus.logger'),
new Reference(LoggerInterface::class),
];

$containerBuilder->addDefinitions([
Expand Down Expand Up @@ -196,7 +197,7 @@ private function registerSnapshotter(ContainerBuilder $containerBuilder): void
$arguments = [
new Reference($this->snapshotStoreServiceId),
new Reference($this->customSnapshotStrategyServiceId),
new Reference('service_bus.logger'),
new Reference(LoggerInterface::class),
];

$containerBuilder->addDefinitions([
Expand Down
7 changes: 4 additions & 3 deletions tests/Module/EventSourcingModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
namespace ServiceBus\EventSourcing\Tests\Module;

use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use ServiceBus\EventSourcing\EventSourcingProvider;
use ServiceBus\EventSourcing\Module\EventSourcingModule;
Expand All @@ -37,9 +38,9 @@ public function createSqlStore(): void
{
$containerBuilder = new ContainerBuilder();
$containerBuilder->addDefinitions([
StorageConfiguration::class => (new Definition(StorageConfiguration::class))->setArguments(['sqlite:///:memory:']),
DatabaseAdapter::class => (new Definition(DoctrineDBALAdapter::class))->setArguments([new Reference(StorageConfiguration::class)]),
'service_bus.logger' => new Definition(NullLogger::class)
StorageConfiguration::class => (new Definition(StorageConfiguration::class))->setArguments(['sqlite:///:memory:']),
DatabaseAdapter::class => (new Definition(DoctrineDBALAdapter::class))->setArguments([new Reference(StorageConfiguration::class)]),
LoggerInterface::class => new Definition(NullLogger::class)
]);

$module = EventSourcingModule::withSqlStorage(DatabaseAdapter::class);
Expand Down

0 comments on commit 00751ca

Please sign in to comment.