/**
  * @test
  * @depends it_translates_aggregate_back_and_forth
  * @param User $loadedUser
  */
 public function it_applies_stream_events(User $loadedUser)
 {
     $newName = 'Jane Doe';
     $translator = new AggregateTranslator();
     $translator->replayStreamEvents($loadedUser, new \ArrayIterator([UserNameChanged::occur($loadedUser->id(), ['username' => $newName])]));
     $this->assertEquals($newName, $loadedUser->name());
 }
Exemplo n.º 2
0
 /**
  * @param UserNameChanged $event
  */
 protected function whenUsernameChanged(UserNameChanged $event)
 {
     $this->name = $event->newUsername();
 }