public function render($name, array $context = [])
 {
     $renderer = $this->loadTemplate($name);
     $templateProfile = new \Twig_Profiler_Profile($name, \Twig_Profiler_Profile::TEMPLATE, $name);
     $this->profiler->enter($templateProfile);
     $html = $renderer($context, ['helpers' => $this->helper->getHelpers()]);
     $this->profiler->leave($templateProfile);
     return $html;
 }
 public function testEnterLeave()
 {
     $mainProfile = $this->prophesize('Twig_Profiler_Profile');
     $mainProfile->addProfile(Argument::type('Twig_Profiler_Profile'))->shouldBeCalled();
     $mainProfile->leave()->shouldBeCalled();
     $watchEvent = $this->prophesize('Symfony\\Component\\Stopwatch\\StopwatchEvent');
     $watchEvent->stop()->shouldBeCalled();
     $watch = $this->prophesize('Symfony\\Component\\Stopwatch\\Stopwatch');
     $watch->start('test', 'template')->willReturn($watchEvent->reveal())->shouldBeCalled();
     $profiler = new HandlebarsProfileExtension($mainProfile->reveal(), $watch->reveal());
     $profile = $this->prophesize('Twig_Profiler_Profile');
     $profile->getName()->willReturn('test');
     $profile->isTemplate()->willReturn(true);
     $profile->leave()->shouldBeCalled();
     $profileInstance = $profile->reveal();
     $profiler->enter($profileInstance);
     $profiler->leave($profileInstance);
 }