Skip to content

Commit

Permalink
Handle new EventStore::load return type
Browse files Browse the repository at this point in the history
  • Loading branch information
codeliner committed Jan 29, 2017
1 parent 90e5342 commit 2532eeb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions tests/KernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
};
Expand Down

0 comments on commit 2532eeb

Please sign in to comment.