/**
  * @covers \Gamma\Pushpin\PushpinBundle\Services\Events\Json\EventParser::getEventJson
  */
 public function testGetEventJson()
 {
     static::assertEquals('{
             "string":"test string",
             "bool":true,
             "int":150,
             "float":150.9999,
             "array": {
                 "key":"value"
             }
         }', self::$instance->getEventJson(self::$event));
 }
 /**
  * @param WebSocketEvent $webSocketEvent
  *
  * @return AbstractJsonEvent
  *
  * @throws \RuntimeException
  */
 private function resolveJsonEvent(WebSocketEvent $webSocketEvent)
 {
     if ($webSocketEvent->type !== TextEventInterface::EVENT_TYPE) {
         throw new \RuntimeException(sprintf('Cannot parse event with type "%s". Expected type is "%s"', $webSocketEvent->type, TextEventInterface::EVENT_TYPE));
     }
     $eventName = $this->parser->getEventName($webSocketEvent);
     $className = sprintf('%s\\%s', $this->baseNamespace, $this->getClassByEventName($eventName));
     if (class_exists($className)) {
         $event = new $className($webSocketEvent->type, $webSocketEvent->content);
         $deSerialized = $this->serializer->deserialize($event);
         return $deSerialized;
     }
     throw new \RuntimeException(sprintf('Class "%s" not exists', $className));
 }
 /**
  * {@inheritdoc}
  */
 public function __construct($type, $content)
 {
     parent::__construct($type, $content);
     $this->name = EventParser::getEventName($this);
     $this->json = EventParser::getEventJson($this);
 }