public function testRender()
 {
     $scriptPath = $this->fixtures() . 'site/mock/test-phtml.phtml';
     $result = PhpRendererEvaluationSandbox::render($scriptPath, $this->getMock('\\Sitegear\\View\\ViewInterface'));
     $this->assertInternalType('string', $result);
     $this->assertNotEmpty($result);
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function render($path, ViewInterface $view)
 {
     LoggerRegistry::debug('PhpRenderer::render({path}, [view])', array('path' => TypeUtilities::describe($path)));
     $renderPath = null;
     foreach ($this->getExtensions() as $extension) {
         if (is_null($renderPath) && file_exists($path . $extension)) {
             $renderPath = $path . $extension;
         }
     }
     if (is_null($renderPath)) {
         throw new \InvalidArgumentException(sprintf('The path "%s" cannot be rendered by PhpRenderer', $path));
     }
     return PhpRendererEvaluationSandbox::render($renderPath, $view);
 }