/**
  * if template exists in both profile and profiler then its name should be returned.
  */
 public function testGetNameValidTemplate()
 {
     $this->profiler->expects($this->any())->method('has')->withAnyParameters()->will($this->returnCallback(array($this, 'profilerHasCallback')));
     $profile = $this->mockProfile();
     $profile->expects($this->any())->method('hasCollector')->will($this->returnCallback(array($this, 'profileHasCollectorCallback')));
     $this->assertEquals('FooBundle:Collector:foo.html.twig', $this->templateManager->getName($profile, 'foo'));
 }
Exemplo n.º 2
0
 /**
  * @Route("/profile/{token}", methods={"GET"}, name="profile")
  */
 public function panelAction(Request $request, $token)
 {
     $panel = $request->query->get('panel', 'request');
     $page = $request->query->get('page', 'home');
     $profile = $this->profileRepository->find($token);
     if (!$profile->hasCollector($panel)) {
         throw new NotFoundHttpException(sprintf('Panel "%s" is not available for token "%s".', $panel, $token));
     }
     return new Response($this->twig->render($this->templateManager->getName($profile, $panel), array('token' => $token, 'profile' => $profile, 'collector' => $profile->getCollector($panel), 'panel' => $panel, 'page' => $page, 'request' => $request, 'templates' => $this->templateManager->getTemplates($profile), 'is_ajax' => $request->isXmlHttpRequest(), 'profiler_markup_version' => 2)), 200, array('Content-Type' => 'text/html'));
 }