diff --git a/composer.lock b/composer.lock index 4856eac2..7f5f9011 100644 --- a/composer.lock +++ b/composer.lock @@ -4668,16 +4668,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.26", + "version": "1.10.27", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "5d660cbb7e1b89253a47147ae44044f49832351f" + "reference": "a9f44dcea06f59d1363b100bb29f297b311fa640" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5d660cbb7e1b89253a47147ae44044f49832351f", - "reference": "5d660cbb7e1b89253a47147ae44044f49832351f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a9f44dcea06f59d1363b100bb29f297b311fa640", + "reference": "a9f44dcea06f59d1363b100bb29f297b311fa640", "shasum": "" }, "require": { @@ -4726,7 +4726,7 @@ "type": "tidelift" } ], - "time": "2023-07-19T12:44:37+00:00" + "time": "2023-08-05T09:57:55+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/src/DependencyInjection/PatchlevelEventSourcingExtension.php b/src/DependencyInjection/PatchlevelEventSourcingExtension.php index 3a9bac22..5bac70e4 100644 --- a/src/DependencyInjection/PatchlevelEventSourcingExtension.php +++ b/src/DependencyInjection/PatchlevelEventSourcingExtension.php @@ -235,6 +235,7 @@ private function configureProjection(array $config, ContainerBuilder $container) new Reference(ProjectionStore::class), new Reference(ProjectorRepository::class), new Reference(ProjectorResolver::class), + new Reference('event_dispatcher', ContainerInterface::NULL_ON_INVALID_REFERENCE), new Reference(LoggerInterface::class, ContainerInterface::NULL_ON_INVALID_REFERENCE), ]) ->addTag('monolog.logger', ['channel' => 'projectionist']); diff --git a/tests/Unit/PatchlevelEventSourcingBundleTest.php b/tests/Unit/PatchlevelEventSourcingBundleTest.php index 0a8a8810..345d0f68 100644 --- a/tests/Unit/PatchlevelEventSourcingBundleTest.php +++ b/tests/Unit/PatchlevelEventSourcingBundleTest.php @@ -31,6 +31,8 @@ use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootRegistry; use Patchlevel\EventSourcing\Metadata\Event\EventRegistry; use Patchlevel\EventSourcing\Projection\Projectionist\RunProjectionistEventBusWrapper; +use Patchlevel\EventSourcing\Projection\Projectionist\DefaultProjectionist; +use Patchlevel\EventSourcing\Projection\Projectionist\Projectionist; use Patchlevel\EventSourcing\Repository\DefaultRepository; use Patchlevel\EventSourcing\Repository\DefaultRepositoryManager; use Patchlevel\EventSourcing\Repository\RepositoryManager; @@ -59,6 +61,8 @@ use Prophecy\PhpUnit\ProphecyTrait; use Psr\Cache\CacheItemPoolInterface; use Psr\Clock\ClockInterface; +use Psr\EventDispatcher\EventDispatcherInterface; +use Psr\Log\LoggerInterface; use Psr\SimpleCache\CacheInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; @@ -652,6 +656,7 @@ public function testProjectionistSync(): void ); self::assertInstanceOf(RunProjectionistEventBusWrapper::class, $container->get(EventBus::class)); + self::assertInstanceOf(DefaultProjectionist::class, $container->get(Projectionist::class)); } public function testProjectionistAsync(): void @@ -761,6 +766,8 @@ private function compileContainer(ContainerBuilder $container, array $config): v $container->set('event.bus', $this->prophesize(MessageBusInterface::class)->reveal()); $container->set('cache.default', $this->prophesize(CacheItemPoolInterface::class)->reveal()); $container->set('lock.default.factory', $this->prophesize(LockFactory::class)->reveal()); + $container->set('event_dispatcher', $this->prophesize(EventDispatcherInterface::class)->reveal()); + $container->set(LoggerInterface::class, $this->prophesize(LoggerInterface::class)->reveal()); $extension = new PatchlevelEventSourcingExtension(); $extension->load($config, $container);