/** * Renders fragment by window state. * * @param \Twig_Environment $environment * @param AbstractWindowsState $windowState * * @return string */ public function renderFragment(\Twig_Environment $environment, AbstractWindowsState $windowState) { $result = ''; $scheduleDelete = false; $windowState->setRenderedSuccessfully(false); try { $uri = $this->windowsStateRequestManager->getUri($windowState->getData()); /** @var HttpKernelExtension $httpKernelExtension */ $httpKernelExtension = $environment->getExtension('http_kernel'); $result = $httpKernelExtension->renderFragment($uri); $windowState->setRenderedSuccessfully(true); return $result; } catch (NotFoundHttpException $e) { $scheduleDelete = true; } catch (\InvalidArgumentException $e) { $scheduleDelete = true; } if ($scheduleDelete) { try { $this->windowsStateManagerRegistry->getManager()->deleteWindowsState($windowState->getId()); } catch (AccessDeniedException $e) { return $result; } } return $result; }
/** * @expectedException \InvalidArgumentException * @expectedExceptionMessage cleanUrl is missing */ public function testDataEmpty() { $this->manager->getUri([]); }