/**
  * template should be loaded for 'foo' because other collectors are
  * missing in profile or in profiler.
  */
 public function testGetTemplates()
 {
     $profile = $this->mockProfile();
     $profile->expects($this->any())->method('hasCollector')->will($this->returnCallback(array($this, 'profilerHasCallback')));
     $this->profiler->expects($this->any())->method('has')->withAnyParameters()->will($this->returnCallback(array($this, 'profileHasCollectorCallback')));
     $result = $this->templateManager->getTemplates($profile);
     $this->assertArrayHasKey('foo', $result);
     $this->assertArrayNotHasKey('bar', $result);
     $this->assertArrayNotHasKey('baz', $result);
 }
예제 #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'));
 }