public function testIsRenderedSuccessfully() { $this->assertFalse($this->windowState->isRenderedSuccessfully()); $this->windowState->setRenderedSuccessfully(true); $this->assertTrue($this->windowState->isRenderedSuccessfully()); }
/** * 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; }