public function testConvertToArrayAndJson()
 {
     $event = new Event('test');
     $expected = array('event' => array('id' => (string) $event, 'attendees' => $event->getAttendees(true), 'prizes' => $event->getPrizes(true)));
     $this->assertEquals($expected, $event->toArray());
     $this->assertEquals(json_encode($expected), $event->toJson());
 }
 /**
  * Saves Event data
  *
  * @param  Event             $event
  * @return null
  * @throws \RuntimeException
  */
 public function saveEvent(Event $event)
 {
     $filename = "{$this->baseDir}/{$event->getId()}.json";
     $saved = file_put_contents($filename, $event->toJson());
     if (false === $saved) {
         throw new \RuntimeException("Failed to write on the file {$event->getId()}.json");
     }
 }