/** * @param OptionVotedEvent $event */ protected function applyOptionVotedEvent(OptionVotedEvent $event) { $number = $event->getOptionNumber(); if ($number === $this->number) { $this->votes++; } }
/** * @test * @group unit */ public function deserialized_and_serialized_event_has_same_values() { $id = new PollId(); $data = array('pollId' => (string) $id, 'optionNumber' => 2); $event = OptionVotedEvent::deserialize($data); $this->assertSame($data, $event->serialize()); }