function it_reconstructs_current_state_of_an_object_by_replaying_its_past_events(Replayable $emitter, Event $isBorn, Event $hasLived, Event $isDead, \ArrayIterator $events) { $isBorn->getName()->willReturn('born'); $isBorn->getAttributes()->willReturn(['id' => 10]); $hasLived->getName()->willReturn('to be'); $hasLived->getAttributes()->willReturn([]); $isDead->getName()->willReturn('wild'); $isDead->getAttributes()->willReturn([]); $events->iterates([$isBorn, $hasLived, $isDead]); $emitter = $this->replay($events, 'spec\\Knp\\Event\\Player\\Replayable'); $emitter->getId()->shouldEqual(10); }