diff --git a/src/Kernel.php b/src/Kernel.php index bfd1239..d65921c 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -166,7 +166,7 @@ function loadEvents( } if ($eventStore->hasStream($streamName)) { - return $eventStore->load($streamName, 1, null, $metadataMatcher)->streamEvents(); + return $eventStore->load($streamName, 1, null, $metadataMatcher); } return new ArrayIterator(); diff --git a/tests/KernelTest.php b/tests/KernelTest.php index e7e53b2..617f574 100644 --- a/tests/KernelTest.php +++ b/tests/KernelTest.php @@ -49,7 +49,7 @@ public function it_builds_command_dispatcher_and_dispatches(): void if (null === $eventStore) { $eventStore = $this->prophesize(EventStore::class); $eventStore->hasStream('foo')->willReturn(true)->shouldBeCalled(); - $eventStore->load(Argument::type(StreamName::class), 1, null, null)->willReturn(new Stream(new StreamName('foo'), new \ArrayIterator()))->shouldBeCalled(); + $eventStore->load(Argument::type(StreamName::class), 1, null, null)->willReturn(new \ArrayIterator())->shouldBeCalled(); $eventStore->appendTo(Argument::type(StreamName::class), Argument::type(\Iterator::class))->shouldBeCalled(); $eventStore = $eventStore->reveal(); } @@ -100,7 +100,7 @@ public function it_builds_command_dispatcher_and_dispatches_but_breaks_when_hand if (null === $eventStore) { $eventStore = $this->prophesize(EventStore::class); $eventStore->hasStream('foo')->willReturn(true)->shouldBeCalled(); - $eventStore->load(Argument::type(StreamName::class), 1, null, null)->willReturn(new Stream(new StreamName('foo'), new \ArrayIterator()))->shouldBeCalled(); + $eventStore->load(Argument::type(StreamName::class), 1, null, null)->willReturn(new \ArrayIterator())->shouldBeCalled(); $eventStore = $eventStore->reveal(); } @@ -203,7 +203,7 @@ public function it_loads_events_when_stream_found(): void $streamName = new StreamName('foo'); $eventStore = $this->prophesize(EventStore::class); $eventStore->hasStream($streamName)->willReturn(true)->shouldBeCalled(); - $eventStore->load($streamName, 1, null, null)->willReturn(new Stream($streamName, new \ArrayIterator()))->shouldBeCalled(); + $eventStore->load($streamName, 1, null, null)->willReturn(new \ArrayIterator())->shouldBeCalled(); return $eventStore->reveal(); };