From da785ab6e2460ca5ae4155514735f970b259ba16 Mon Sep 17 00:00:00 2001 From: Daniel Badura Date: Thu, 19 May 2022 15:09:49 +0000 Subject: [PATCH 1/6] remove old clock and replace it with a service, also add decorator --- src/Clock.php | 44 ---------- src/Clock/Clock.php | 12 +++ src/Clock/FreezeClock.php | 34 ++++++++ src/Clock/SystemClock.php | 15 ++++ .../Decorator/RecordedOnDecorator.php | 20 +++++ src/Repository/DefaultRepository.php | 4 +- tests/Unit/Clock/FreezeClockTest.php | 50 +++++++++++ tests/Unit/Clock/SystemClockTest.php | 23 +++++ tests/Unit/ClockTest.php | 84 ------------------- tests/Unit/EventBus/MessageTest.php | 16 ---- 10 files changed, 156 insertions(+), 146 deletions(-) delete mode 100644 src/Clock.php create mode 100644 src/Clock/Clock.php create mode 100644 src/Clock/FreezeClock.php create mode 100644 src/Clock/SystemClock.php create mode 100644 src/EventBus/Decorator/RecordedOnDecorator.php create mode 100644 tests/Unit/Clock/FreezeClockTest.php create mode 100644 tests/Unit/Clock/SystemClockTest.php delete mode 100644 tests/Unit/ClockTest.php diff --git a/src/Clock.php b/src/Clock.php deleted file mode 100644 index d438790c..00000000 --- a/src/Clock.php +++ /dev/null @@ -1,44 +0,0 @@ -modify(sprintf('+%s seconds', $seconds)); - - return; - } - - sleep($seconds); - } - - public static function createDateTimeImmutable(): DateTimeImmutable - { - return self::$frozenDateTime ?: new DateTimeImmutable(); - } - - public static function reset(): void - { - self::$frozenDateTime = null; - } -} diff --git a/src/Clock/Clock.php b/src/Clock/Clock.php new file mode 100644 index 00000000..50fed58c --- /dev/null +++ b/src/Clock/Clock.php @@ -0,0 +1,12 @@ +frozenDateTime = $frozenDateTime; + } + + /** + * @param positive-int $seconds + */ + public function sleep(int $seconds): void + { + $this->frozenDateTime = $this->frozenDateTime->modify(sprintf('+%s seconds', $seconds)); + } + + public function createDateTimeImmutable(): DateTimeImmutable + { + return $this->frozenDateTime; + } +} diff --git a/src/Clock/SystemClock.php b/src/Clock/SystemClock.php new file mode 100644 index 00000000..a4c7ffe4 --- /dev/null +++ b/src/Clock/SystemClock.php @@ -0,0 +1,15 @@ +withRecordedOn($this->clock->createDateTimeImmutable()); + } +} diff --git a/src/Repository/DefaultRepository.php b/src/Repository/DefaultRepository.php index 977ac911..6dfced72 100644 --- a/src/Repository/DefaultRepository.php +++ b/src/Repository/DefaultRepository.php @@ -4,8 +4,8 @@ namespace Patchlevel\EventSourcing\Repository; +use DateTimeImmutable; use Patchlevel\EventSourcing\Aggregate\AggregateRoot; -use Patchlevel\EventSourcing\Clock; use Patchlevel\EventSourcing\EventBus\Decorator\MessageDecorator; use Patchlevel\EventSourcing\EventBus\EventBus; use Patchlevel\EventSourcing\EventBus\Message; @@ -129,7 +129,7 @@ static function (object $event) use ($aggregate, &$playhead, $messageDecorator) ->withAggregateClass($aggregate::class) ->withAggregateId($aggregate->aggregateRootId()) ->withPlayhead(++$playhead) - ->withRecordedOn(Clock::createDateTimeImmutable()); + ->withRecordedOn(new DateTimeImmutable()); if ($messageDecorator) { $message = $messageDecorator($message); diff --git a/tests/Unit/Clock/FreezeClockTest.php b/tests/Unit/Clock/FreezeClockTest.php new file mode 100644 index 00000000..da8781d1 --- /dev/null +++ b/tests/Unit/Clock/FreezeClockTest.php @@ -0,0 +1,50 @@ +createDateTimeImmutable(); + + self::assertSame($current, $new); + } + + public function testSleep(): void + { + $date1 = new DateTimeImmutable(); + $clock = new FreezeClock($date1); + $clock->sleep(1); + $date2 = $clock->createDateTimeImmutable(); + + $diff = $date1->diff($date2); + + self::assertSame(1, $diff->s); + } + + public function testReFreeze(): void + { + $date1 = new DateTimeImmutable(); + $clock = new FreezeClock($date1); + $new1 = $clock->createDateTimeImmutable(); + + $date2 = new DateTimeImmutable(); + $clock->freeze($date2); + $new2 = $clock->createDateTimeImmutable(); + + self::assertSame($date1, $new1); + self::assertSame($date2, $new2); + self::assertNotSame($new1, $new2); + } +} diff --git a/tests/Unit/Clock/SystemClockTest.php b/tests/Unit/Clock/SystemClockTest.php new file mode 100644 index 00000000..6c438d3b --- /dev/null +++ b/tests/Unit/Clock/SystemClockTest.php @@ -0,0 +1,23 @@ +createDateTimeImmutable(); + $after = new DateTimeImmutable(); + + self::assertGreaterThanOrEqual($before, $date); + self::assertLessThanOrEqual($after, $date); + } +} diff --git a/tests/Unit/ClockTest.php b/tests/Unit/ClockTest.php deleted file mode 100644 index ad8f57da..00000000 --- a/tests/Unit/ClockTest.php +++ /dev/null @@ -1,84 +0,0 @@ -diff($date2); - - self::assertSame(1, $diff->s); - } - - public function testSleepWithFrozenClock(): void - { - $current = new DateTimeImmutable(); - Clock::freeze($current); - - $date1 = Clock::createDateTimeImmutable(); - Clock::sleep(45); - $date2 = Clock::createDateTimeImmutable(); - - $diff = $date1->diff($date2); - - self::assertSame(45, $diff->s); - } -} diff --git a/tests/Unit/EventBus/MessageTest.php b/tests/Unit/EventBus/MessageTest.php index 05285c5c..ea2a5436 100644 --- a/tests/Unit/EventBus/MessageTest.php +++ b/tests/Unit/EventBus/MessageTest.php @@ -5,7 +5,6 @@ namespace Patchlevel\EventSourcing\Tests\Unit\EventBus; use DateTimeImmutable; -use Patchlevel\EventSourcing\Clock; use Patchlevel\EventSourcing\EventBus\HeaderNotFound; use Patchlevel\EventSourcing\EventBus\Message; use Patchlevel\EventSourcing\Tests\Unit\Fixture\Email; @@ -17,17 +16,8 @@ /** @covers \Patchlevel\EventSourcing\EventBus\Message */ class MessageTest extends TestCase { - public function tearDown(): void - { - Clock::reset(); - } - public function testEmptyMessage(): void { - $recordedAt = new DateTimeImmutable('2020-05-06 13:34:24'); - - Clock::freeze($recordedAt); - $id = ProfileId::fromString('1'); $email = Email::fromString('hallo@patchlevel.de'); @@ -47,8 +37,6 @@ public function testCreateMessageWithHeader(): void { $recordedAt = new DateTimeImmutable('2020-05-06 13:34:24'); - Clock::freeze($recordedAt); - $id = ProfileId::fromString('1'); $email = Email::fromString('hallo@patchlevel.de'); @@ -74,8 +62,6 @@ public function testChangeHeader(): void { $recordedAt = new DateTimeImmutable('2020-05-06 13:34:24'); - Clock::freeze($recordedAt); - $id = ProfileId::fromString('1'); $email = Email::fromString('hallo@patchlevel.de'); @@ -120,8 +106,6 @@ public function testCustomHeaders(): void { $recordedAt = new DateTimeImmutable('2020-05-06 13:34:24'); - Clock::freeze($recordedAt); - $id = ProfileId::fromString('1'); $email = Email::fromString('hallo@patchlevel.de'); From 496a919ff69ac9c59774d823a968db5a52f3140f Mon Sep 17 00:00:00 2001 From: Daniel Badura Date: Fri, 20 May 2022 08:44:30 +0000 Subject: [PATCH 2/6] rename methods for the clocks --- src/Clock/Clock.php | 2 +- src/Clock/FreezeClock.php | 4 ++-- src/Clock/SystemClock.php | 2 +- src/EventBus/Decorator/RecordedOnDecorator.php | 2 +- tests/Unit/Clock/FreezeClockTest.php | 10 +++++----- tests/Unit/Clock/SystemClockTest.php | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Clock/Clock.php b/src/Clock/Clock.php index 50fed58c..7be4fad8 100644 --- a/src/Clock/Clock.php +++ b/src/Clock/Clock.php @@ -8,5 +8,5 @@ interface Clock { - public function createDateTimeImmutable(): DateTimeImmutable; + public function create(): DateTimeImmutable; } diff --git a/src/Clock/FreezeClock.php b/src/Clock/FreezeClock.php index 0372f3fa..518b3c35 100644 --- a/src/Clock/FreezeClock.php +++ b/src/Clock/FreezeClock.php @@ -14,7 +14,7 @@ public function __construct(private DateTimeImmutable $frozenDateTime) { } - public function freeze(DateTimeImmutable $frozenDateTime): void + public function update(DateTimeImmutable $frozenDateTime): void { $this->frozenDateTime = $frozenDateTime; } @@ -27,7 +27,7 @@ public function sleep(int $seconds): void $this->frozenDateTime = $this->frozenDateTime->modify(sprintf('+%s seconds', $seconds)); } - public function createDateTimeImmutable(): DateTimeImmutable + public function create(): DateTimeImmutable { return $this->frozenDateTime; } diff --git a/src/Clock/SystemClock.php b/src/Clock/SystemClock.php index a4c7ffe4..08d2c154 100644 --- a/src/Clock/SystemClock.php +++ b/src/Clock/SystemClock.php @@ -8,7 +8,7 @@ final class SystemClock implements Clock { - public function createDateTimeImmutable(): DateTimeImmutable + public function create(): DateTimeImmutable { return new DateTimeImmutable(); } diff --git a/src/EventBus/Decorator/RecordedOnDecorator.php b/src/EventBus/Decorator/RecordedOnDecorator.php index 1d09199b..51ea82c1 100644 --- a/src/EventBus/Decorator/RecordedOnDecorator.php +++ b/src/EventBus/Decorator/RecordedOnDecorator.php @@ -15,6 +15,6 @@ public function __construct(private readonly Clock $clock) public function __invoke(Message $message): Message { - return $message->withRecordedOn($this->clock->createDateTimeImmutable()); + return $message->withRecordedOn($this->clock->create()); } } diff --git a/tests/Unit/Clock/FreezeClockTest.php b/tests/Unit/Clock/FreezeClockTest.php index da8781d1..12f40325 100644 --- a/tests/Unit/Clock/FreezeClockTest.php +++ b/tests/Unit/Clock/FreezeClockTest.php @@ -16,7 +16,7 @@ public function testCreateDateTimeImmutableWithFrozenClock(): void $current = new DateTimeImmutable(); $clock = new FreezeClock($current); - $new = $clock->createDateTimeImmutable(); + $new = $clock->create(); self::assertSame($current, $new); } @@ -26,7 +26,7 @@ public function testSleep(): void $date1 = new DateTimeImmutable(); $clock = new FreezeClock($date1); $clock->sleep(1); - $date2 = $clock->createDateTimeImmutable(); + $date2 = $clock->create(); $diff = $date1->diff($date2); @@ -37,11 +37,11 @@ public function testReFreeze(): void { $date1 = new DateTimeImmutable(); $clock = new FreezeClock($date1); - $new1 = $clock->createDateTimeImmutable(); + $new1 = $clock->create(); $date2 = new DateTimeImmutable(); - $clock->freeze($date2); - $new2 = $clock->createDateTimeImmutable(); + $clock->update($date2); + $new2 = $clock->create(); self::assertSame($date1, $new1); self::assertSame($date2, $new2); diff --git a/tests/Unit/Clock/SystemClockTest.php b/tests/Unit/Clock/SystemClockTest.php index 6c438d3b..f935c642 100644 --- a/tests/Unit/Clock/SystemClockTest.php +++ b/tests/Unit/Clock/SystemClockTest.php @@ -14,7 +14,7 @@ class SystemClockTest extends TestCase public function testCreateDateTimeImmutable(): void { $before = new DateTimeImmutable(); - $date = (new SystemClock())->createDateTimeImmutable(); + $date = (new SystemClock())->create(); $after = new DateTimeImmutable(); self::assertGreaterThanOrEqual($before, $date); From 5fe169de3455386fdfc41b0a31e5fe0144ba8470 Mon Sep 17 00:00:00 2001 From: Daniel Badura Date: Fri, 20 May 2022 13:11:20 +0000 Subject: [PATCH 3/6] if no decorator is given, use RecordedOnDecorator --- src/Repository/DefaultRepository.php | 12 +++++------- src/Repository/DefaultRepositoryManager.php | 6 ++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Repository/DefaultRepository.php b/src/Repository/DefaultRepository.php index 6dfced72..40b44f3e 100644 --- a/src/Repository/DefaultRepository.php +++ b/src/Repository/DefaultRepository.php @@ -6,7 +6,9 @@ use DateTimeImmutable; use Patchlevel\EventSourcing\Aggregate\AggregateRoot; +use Patchlevel\EventSourcing\Clock\SystemClock; use Patchlevel\EventSourcing\EventBus\Decorator\MessageDecorator; +use Patchlevel\EventSourcing\EventBus\Decorator\RecordedOnDecorator; use Patchlevel\EventSourcing\EventBus\EventBus; use Patchlevel\EventSourcing\EventBus\Message; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootMetadata; @@ -37,7 +39,7 @@ final class DefaultRepository implements Repository private ?SnapshotStore $snapshotStore; private LoggerInterface $logger; private AggregateRootMetadata $metadata; - private ?MessageDecorator $messageDecorator; + private MessageDecorator $messageDecorator; /** * @param class-string $aggregateClass @@ -54,7 +56,7 @@ public function __construct( $this->eventBus = $eventBus; $this->aggregateClass = $aggregateClass; $this->snapshotStore = $snapshotStore; - $this->messageDecorator = $messageDecorator; + $this->messageDecorator = $messageDecorator ?? new RecordedOnDecorator(new SystemClock()); $this->logger = $logger ?? new NullLogger(); $this->metadata = $aggregateClass::metadata(); } @@ -131,11 +133,7 @@ static function (object $event) use ($aggregate, &$playhead, $messageDecorator) ->withPlayhead(++$playhead) ->withRecordedOn(new DateTimeImmutable()); - if ($messageDecorator) { - $message = $messageDecorator($message); - } - - return $message; + return $messageDecorator($message); }, $events ); diff --git a/src/Repository/DefaultRepositoryManager.php b/src/Repository/DefaultRepositoryManager.php index d49581a7..a9663e76 100644 --- a/src/Repository/DefaultRepositoryManager.php +++ b/src/Repository/DefaultRepositoryManager.php @@ -5,7 +5,9 @@ namespace Patchlevel\EventSourcing\Repository; use Patchlevel\EventSourcing\Aggregate\AggregateRoot; +use Patchlevel\EventSourcing\Clock\SystemClock; use Patchlevel\EventSourcing\EventBus\Decorator\MessageDecorator; +use Patchlevel\EventSourcing\EventBus\Decorator\RecordedOnDecorator; use Patchlevel\EventSourcing\EventBus\EventBus; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootClassNotRegistered; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootRegistry; @@ -22,7 +24,7 @@ final class DefaultRepositoryManager implements RepositoryManager private Store $store; private EventBus $eventBus; private ?SnapshotStore $snapshotStore; - private ?MessageDecorator $messageDecorator; + private MessageDecorator $messageDecorator; private LoggerInterface $logger; /** @var array, Repository> */ @@ -40,7 +42,7 @@ public function __construct( $this->store = $store; $this->eventBus = $eventBus; $this->snapshotStore = $snapshotStore; - $this->messageDecorator = $messageDecorator; + $this->messageDecorator = $messageDecorator ?? new RecordedOnDecorator(new SystemClock()); $this->logger = $logger ?? new NullLogger(); } From cfbe1ee508a3b2975628e6ab0769a88af62e7b28 Mon Sep 17 00:00:00 2001 From: Daniel Badura Date: Fri, 20 May 2022 13:18:23 +0000 Subject: [PATCH 4/6] remove withRecordedOn in favor for the decorator --- src/Repository/DefaultRepository.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Repository/DefaultRepository.php b/src/Repository/DefaultRepository.php index 40b44f3e..ba2e2109 100644 --- a/src/Repository/DefaultRepository.php +++ b/src/Repository/DefaultRepository.php @@ -4,7 +4,6 @@ namespace Patchlevel\EventSourcing\Repository; -use DateTimeImmutable; use Patchlevel\EventSourcing\Aggregate\AggregateRoot; use Patchlevel\EventSourcing\Clock\SystemClock; use Patchlevel\EventSourcing\EventBus\Decorator\MessageDecorator; @@ -130,8 +129,7 @@ static function (object $event) use ($aggregate, &$playhead, $messageDecorator) $message = Message::create($event) ->withAggregateClass($aggregate::class) ->withAggregateId($aggregate->aggregateRootId()) - ->withPlayhead(++$playhead) - ->withRecordedOn(new DateTimeImmutable()); + ->withPlayhead(++$playhead); return $messageDecorator($message); }, From b25121bcf29bbcb73ccbaa0a518ffa1cfcd35723 Mon Sep 17 00:00:00 2001 From: Daniel Badura Date: Fri, 20 May 2022 13:25:53 +0000 Subject: [PATCH 5/6] fix integration tests --- .../BasicIntegrationTest.php | 72 ++++++++++++++----- 1 file changed, 54 insertions(+), 18 deletions(-) diff --git a/tests/Integration/BasicImplementation/BasicIntegrationTest.php b/tests/Integration/BasicImplementation/BasicIntegrationTest.php index f3cfedb7..6fc78df0 100644 --- a/tests/Integration/BasicImplementation/BasicIntegrationTest.php +++ b/tests/Integration/BasicImplementation/BasicIntegrationTest.php @@ -5,12 +5,16 @@ namespace Patchlevel\EventSourcing\Tests\Integration\BasicImplementation; use Doctrine\DBAL\Connection; +use Patchlevel\EventSourcing\Clock\SystemClock; +use Patchlevel\EventSourcing\EventBus\Decorator\ChainMessageDecorator; +use Patchlevel\EventSourcing\EventBus\Decorator\RecordedOnDecorator; use Patchlevel\EventSourcing\EventBus\DefaultEventBus; use Patchlevel\EventSourcing\EventBus\SymfonyEventBus; +use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootRegistry; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AttributeAggregateRootRegistryFactory; use Patchlevel\EventSourcing\Projection\MetadataAwareProjectionHandler; use Patchlevel\EventSourcing\Projection\ProjectionListener; -use Patchlevel\EventSourcing\Repository\DefaultRepository; +use Patchlevel\EventSourcing\Repository\DefaultRepositoryManager; use Patchlevel\EventSourcing\Schema\DoctrineSchemaManager; use Patchlevel\EventSourcing\Serializer\DefaultEventSerializer; use Patchlevel\EventSourcing\Snapshot\Adapter\InMemorySnapshotAdapter; @@ -60,13 +64,14 @@ public function testSuccessful(): void 'eventstore' ); - $repository = new DefaultRepository( + $manager = new DefaultRepositoryManager( + new AggregateRootRegistry(['profile' => Profile::class]), $store, $eventStream, - Profile::class, null, - new FooMessageDecorator() + new ChainMessageDecorator([new RecordedOnDecorator(new SystemClock()), new FooMessageDecorator()]) ); + $repository = $manager->get(Profile::class); // create tables $profileProjection->create(); @@ -82,7 +87,14 @@ public function testSuccessful(): void self::assertSame('1', $result['id']); self::assertSame('John', $result['name']); - $repository = new DefaultRepository($store, $eventStream, Profile::class); + $manager = new DefaultRepositoryManager( + new AggregateRootRegistry(['profile' => Profile::class]), + $store, + $eventStream, + null, + new ChainMessageDecorator([new RecordedOnDecorator(new SystemClock())]) + ); + $repository = $manager->get(Profile::class); $profile = $repository->load('1'); self::assertInstanceOf(Profile::class, $profile); @@ -111,7 +123,14 @@ public function testWithSymfonySuccessful(): void 'eventstore' ); - $repository = new DefaultRepository($store, $eventStream, Profile::class); + $manager = new DefaultRepositoryManager( + new AggregateRootRegistry(['profile' => Profile::class]), + $store, + $eventStream, + null, + new ChainMessageDecorator([new RecordedOnDecorator(new SystemClock())]) + ); + $repository = $manager->get(Profile::class); // create tables $profileProjection->create(); @@ -127,13 +146,14 @@ public function testWithSymfonySuccessful(): void self::assertSame('1', $result['id']); self::assertSame('John', $result['name']); - $repository = new DefaultRepository( + $manager = new DefaultRepositoryManager( + new AggregateRootRegistry(['profile' => Profile::class]), $store, $eventStream, - Profile::class, null, - new FooMessageDecorator() + new ChainMessageDecorator([new RecordedOnDecorator(new SystemClock()), new FooMessageDecorator()]) ); + $repository = $manager->get(Profile::class); $profile = $repository->load('1'); @@ -161,13 +181,14 @@ public function testMultiTableSuccessful(): void (new AttributeAggregateRootRegistryFactory())->create([__DIR__ . '/Aggregate']), ); - $repository = new DefaultRepository( + $manager = new DefaultRepositoryManager( + new AggregateRootRegistry(['profile' => Profile::class]), $store, $eventStream, - Profile::class, null, - new FooMessageDecorator() + new ChainMessageDecorator([new RecordedOnDecorator(new SystemClock()), new FooMessageDecorator()]) ); + $repository = $manager->get(Profile::class); // create tables $profileProjection->create(); @@ -183,7 +204,14 @@ public function testMultiTableSuccessful(): void self::assertSame('1', $result['id']); self::assertSame('John', $result['name']); - $repository = new DefaultRepository($store, $eventStream, Profile::class); + $manager = new DefaultRepositoryManager( + new AggregateRootRegistry(['profile' => Profile::class]), + $store, + $eventStream, + null, + new ChainMessageDecorator([new RecordedOnDecorator(new SystemClock())]) + ); + $repository = $manager->get(Profile::class); $profile = $repository->load('1'); self::assertInstanceOf(Profile::class, $profile); @@ -213,13 +241,14 @@ public function testSnapshot(): void $snapshotStore = new DefaultSnapshotStore(['default' => new InMemorySnapshotAdapter()]); - $repository = new DefaultRepository( + $manager = new DefaultRepositoryManager( + new AggregateRootRegistry(['profile' => Profile::class]), $store, $eventStream, - Profile::class, - $snapshotStore, - new FooMessageDecorator() + null, + new ChainMessageDecorator([new RecordedOnDecorator(new SystemClock()), new FooMessageDecorator()]) ); + $repository = $manager->get(Profile::class); // create tables $profileProjection->create(); @@ -235,7 +264,14 @@ public function testSnapshot(): void self::assertSame('1', $result['id']); self::assertSame('John', $result['name']); - $repository = new DefaultRepository($store, $eventStream, Profile::class, $snapshotStore); + $manager = new DefaultRepositoryManager( + new AggregateRootRegistry(['profile' => Profile::class]), + $store, + $eventStream, + null, + new ChainMessageDecorator([new RecordedOnDecorator(new SystemClock())]) + ); + $repository = $manager->get(Profile::class); $profile = $repository->load('1'); self::assertInstanceOf(Profile::class, $profile); From 2b2f50e6e1991259ff9227361cfdfc775b200b78 Mon Sep 17 00:00:00 2001 From: Daniel Badura Date: Fri, 20 May 2022 13:29:39 +0000 Subject: [PATCH 6/6] fix integration tests --- .../Integration/BasicImplementation/BasicIntegrationTest.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/Integration/BasicImplementation/BasicIntegrationTest.php b/tests/Integration/BasicImplementation/BasicIntegrationTest.php index 6fc78df0..399ffca5 100644 --- a/tests/Integration/BasicImplementation/BasicIntegrationTest.php +++ b/tests/Integration/BasicImplementation/BasicIntegrationTest.php @@ -239,13 +239,11 @@ public function testSnapshot(): void 'eventstore' ); - $snapshotStore = new DefaultSnapshotStore(['default' => new InMemorySnapshotAdapter()]); - $manager = new DefaultRepositoryManager( new AggregateRootRegistry(['profile' => Profile::class]), $store, $eventStream, - null, + new DefaultSnapshotStore(['default' => new InMemorySnapshotAdapter()]), new ChainMessageDecorator([new RecordedOnDecorator(new SystemClock()), new FooMessageDecorator()]) ); $repository = $manager->get(Profile::class);