/** * @test */ public function it_is_serializable() { $id = CommitteeId::generate(); $event = new CommitteeNameChanged($id, 'S[ck]rip(t|t?c)ie 2'); $this->assertEquals($event, CommitteeNameChanged::deserialize($event->serialize())); $this->assertEquals($id, $event->committeeId()); $this->assertEquals('S[ck]rip(t|t?c)ie 2', $event->name()); }
public function whenCommitteeNameChanged(CommitteeNameChanged $event) { $committee = $this->committees->find((string) $event->committeeId()); $committee = $committee->changeName($event->name()); $this->committees->save($committee); }
protected function applyCommitteeNameChanged(CommitteeNameChanged $event) { $this->name = $event->name(); }