function it_get_stream_of_id_given(EventStream $stream, Id $aggregateId) { $aggregateId->id()->willReturn('aggregate-id'); $eventCollection = new DomainEventCollection([new DomainEventStub('foo', 'bar')]); $stream->events()->shouldBeCalled()->willReturn($eventCollection); $stream->aggregateId()->shouldBeCalled()->willReturn($aggregateId); $this->appendTo($stream); $this->streamOfId($aggregateId)->shouldReturnAnInstanceOf(EventStream::class); }