public function testGetJsonData()
 {
     $data = ['test' => true];
     $this->windowState->setData($data);
     $this->assertEquals($data, $this->windowState->getData());
     $this->assertEquals(json_encode($data), $this->windowState->getJsonData());
 }
 public function testGetJsonData()
 {
     $state = new WindowsState();
     $data = array('test' => true);
     $state->setData($data);
     $this->assertEquals($data, $state->getData());
     $this->assertEquals(json_encode($data), $state->getJsonData());
 }
 /**
  * Renders fragment by window state.
  *
  * @param \Twig_Environment $environment
  * @param WindowsState $windowState
  *
  * @return string
  */
 public function renderFragment(\Twig_Environment $environment, WindowsState $windowState)
 {
     $result = '';
     $windowState->setRenderedSuccessfully(false);
     $data = $windowState->getData();
     if (isset($data['cleanUrl'])) {
         if (isset($data['type'])) {
             $wid = isset($data['wid']) ? $data['wid'] : $this->getUniqueIdentifier();
             $uri = $this->getUrlWithContainer($data['cleanUrl'], $data['type'], $wid);
         } else {
             $uri = $data['cleanUrl'];
         }
     } else {
         return $result;
     }
     try {
         /** @var HttpKernelExtension $httpKernelExtension */
         $httpKernelExtension = $environment->getExtension('http_kernel');
         $result = $httpKernelExtension->renderFragment($uri);
         $windowState->setRenderedSuccessfully(true);
         return $result;
     } catch (NotFoundHttpException $e) {
         $this->em->remove($windowState);
         $this->em->flush($windowState);
     }
     return $result;
 }